cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RomanKorchak
Helper IV
Helper IV

Associative array equivalent in PowerApps

Hi

I need to create some kind of array so I can set text using its values:

MyArray={1:"one",2:"two"}
Set(val1, 1)
And then set text field to MyArray[val1]

Is it possible in Powerapps?

Thanks

2 REPLIES 2
Carsten_Growth
Power Apps
Power Apps

Your array is simply a 

 

 

Table({Color:"red"}, {Color:"green"}, {Color:"blue"})

 

In your case I would operate with a Collection that holds your styles.
You can also take a look at this component https://powerusers.microsoft.com/t5/Canvas-Apps-Components-Samples/PPOC2020-Company-Color-Scheme-Loo... which allows you to story color styles in a collection that then can be called via Lookup(...)

 

Max44
Helper V
Helper V

PowerApps does not support "arrays", for GA or beyond, because it cannot encourage nor accomodate random access into data. The closest data structure in PowerApps would be a single-column table. Still, it's a table, just like SQL tables for example, and as such it is not indexable by row index, i.e. there is no random access. You can think of columns as homogeneous vertical arrays of named values.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,344)