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

View solution in original post

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
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,549)