cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rico98
Helper I
Helper I

Access a Collection property Dynamically with Variable

 

Hi Power Platform Community, do you know if it is possible to access a collection property dynamically in power apps?

 

rico98_0-1649748640859.jpeg

 

I have the following myMonth property that I want to use to dynamically access the value of a property.

 

and accessing it simply gives me an error like this:

rico98_1-1649748640859.jpeg

 

I am basically trying to reproduce a transposed table. 

Happy for any workaround to being introduced. Thank you.

 

Regards,

Rico.

 

7 REPLIES 7
C-Papa
Super User
Super User

hi, you need to use the Concat() function to do this. something like Concat(Table1,Text(myMonth,"dd-mm-yyyy"),", ")

rico98
Helper I
Helper I

Thanks for your suggestion. I tried something like you suggested, but still not getting the right value.

 

Basically, I want to get this value:

rico98_0-1649753874427.png

 

But I am getting the following value instead:

rico98_1-1649753923791.png

Is there anything that I did wrong.

I tried without the Text function too.

 

 

C-Papa
Super User
Super User

You can't pass the column name dynamically into the function. you would need to use the If or Switch function to change the formula for all of the months, but this isn't really scalable. I would have probably done it a bit differently by having a "Date" column rather than a new column for every year. This would allow you to filter the database based on a date and return the values you need, which would all be in one column.  Concat() would then work as expected. 

rico98
Helper I
Helper I

Thanks for your suggestion.

 

But this is the business requirements, they want to be able to add a new month as a column.

 

Regards,

Rico.

C-Papa
Super User
Super User

In that case i think you are unlikely to get an app that works for them through PowerApps. By doing it the way i suggested you will still get the correct data, it will also allow you to filter much better and your table will not be so large. you have to remember that if your table is growing in columns year on year you will get to a point where its not useable. i can't see this being a scalable approach. 

 

if you google "powerapps select column dynamically" you will see lots of threads where this has previously been talked about. Good luck

rico98
Helper I
Helper I

Thank you so much for your detailed suggestion and explanation.

I will take this into consideration. Have a great day.

@rico98 ,

If you want confirmation on @C-Papa 's explanation of dynamic referral of Power Apps elements such as Field, List or Control names, then it is absolutely correct - you simply cannot do it.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (3,697)