cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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

Hi @jgarner ,

 

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
Highlighted
Community Support
Community Support

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

Hi @jgarner ,

 

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

Highlighted
Frequent Visitor

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

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,277)