cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Can't convert this data type. Power Apps can't convert this Text to a Table.

Hello,

 

I am trying to understand the error message that I am getting. Here is my code:

 

ClearCollect(TestA, {itemsA: ["hello", "chicken", "nuggets", "meow", "cow"]});
ClearCollect(TestB, {itemsB: ["meow", "nuggets", "owl", "road", "apple"]});

Clear(Results);
ForAll(
    TestA, 
    ForAll(itemsA, Collect(Results, {Item: Value in TestB.itemsB}))
)

 

What I would like is a collection (called Results) containing true and false values indicating whether the string from TestA.itemsA is in TestB.itemsB. The expected output for Results is:

 

Results=[false, false, true, true, false]

 

Currently, Value gets red-underlined with the message (as in the title of this post): Can't convert this data type. Power Apps can't convert this Text to a Table.

 

Could anyone suggest a way that I can rewrite this code to produce Results correctly?

Here is another variation that I tried; no error was reported in this case, but I don't understand the difference between the two (or what is causing my error).

 

ClearCollect(TestA, {itemsA: ["hello", "chicken", "nuggets", "meow", "cow"]}); 

Set(MyList, ["chicken", "meow", "cook", "open"]);
Clear(Results);
ForAll(
    TestA, 
    ForAll(itemsA, Collect(Results, {Item: Value in MyList}))
)

 

Thank you for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to modify the first code as follows:

 

ClearCollect(TestA, {itemsA: ["hello", "chicken", "nuggets", "meow", "cow"]});
ClearCollect(TestB, {itemsB: ["meow", "nuggets", "owl", "road", "apple"]});

Clear(Results);
ForAll(
TestA,
ForAll(itemsA, Collect(Results, {Item: Value in First(TestB).itemsB}))
)

 

the difference is that TestB.ItemsB is actually an object, let's save the TestB.ItemsB to a new collection to see what is it. it is actually a single column table with a nested table. 

Snipaste_2020-06-11_15-56-34.png

If we change to use  First(TestB).itemsB, let see what is it. It is a Array, so the condition Value in First(TestB).itemsB can work.

 

Your second code is similar to mine in principle , you just defined MyList as an Array, so it works.

Hope this helps,.

Sik

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to modify the first code as follows:

 

ClearCollect(TestA, {itemsA: ["hello", "chicken", "nuggets", "meow", "cow"]});
ClearCollect(TestB, {itemsB: ["meow", "nuggets", "owl", "road", "apple"]});

Clear(Results);
ForAll(
TestA,
ForAll(itemsA, Collect(Results, {Item: Value in First(TestB).itemsB}))
)

 

the difference is that TestB.ItemsB is actually an object, let's save the TestB.ItemsB to a new collection to see what is it. it is actually a single column table with a nested table. 

Snipaste_2020-06-11_15-56-34.png

If we change to use  First(TestB).itemsB, let see what is it. It is a Array, so the condition Value in First(TestB).itemsB can work.

 

Your second code is similar to mine in principle , you just defined MyList as an Array, so it works.

Hope this helps,.

Sik

Anonymous
Not applicable

Thanks @v-siky-msft. Also good idea to check the data type using the View tab. I will use that to help next time when I get stuck.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,510)