Hello,
I have the following problem. In a gallery "gal_Datapoints" I have a list of pairs of values (voltage, current).
Example (voltage, current):
0, 1
2, 3
4, 5
6, 7
Based on the gallery I want to create a collection. I use the onselect of a button for this. All values of the collection are to be run through.
If the value of the voltage = 0, then A is to be written to the collection, otherwise B.
Clear(col_Datapoints);
ForAll(
gal_Collection.AllItems,
Collect(
col_Datapoints,
If(
Voltage = 0,
"A",
"B"
)
)
);
The formula shown for this is not correct.
How do you implement something appropriate in Power Apps?
Many thanks for your tips,
Greetings Michael
Solved! Go to Solution.
To start, your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not. ForAll is a function that returns a table of records based on your iteration table and record schema.
It is more efficient to use the function as intended and will provide better performance.
Your formula should be the following:
ClearCollect(col_Datapoints,
ForAll(gal_Collection.AllItems,
{Value: If(Voltage = 0, "A", "B")}
)
)
Not entirely sure of your purpose for the collection (as your Gallery already contains the data - a collection would be duplicating), and not entirely sure what you wanted in the collection, other than a value of A or B. And finally, not entirely sure what Voltage is in your gallery context...is that a column value or a control?
To start, your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not. ForAll is a function that returns a table of records based on your iteration table and record schema.
It is more efficient to use the function as intended and will provide better performance.
Your formula should be the following:
ClearCollect(col_Datapoints,
ForAll(gal_Collection.AllItems,
{Value: If(Voltage = 0, "A", "B")}
)
)
Not entirely sure of your purpose for the collection (as your Gallery already contains the data - a collection would be duplicating), and not entirely sure what you wanted in the collection, other than a value of A or B. And finally, not entirely sure what Voltage is in your gallery context...is that a column value or a control?
User | Count |
---|---|
254 | |
106 | |
95 | |
50 | |
39 |