Hello,
In a custom plugin i'm calling an API to retrieve a list of items, and i would like those items to be displayed as choices for the user in a DynamicClosedListEntity.
The items are in a table type variable, and i know that to be displayed as choices, each item must have a DisplayName property.
So i want to add this property for each item and to set its value to a concatenation of some of its properties.
I suppose the best way to achieve this is to rebuild a new variable in a SetVariable block, but i'm struggling in vain with FX functions.
Is there anyone to help me?
Thank you
Yes, I think so. Although I don't know if there's a better way to rename a table property in Power Fx?
The JSON comes from this mocked API and it looks like this:
[
{
"id": 1,
"name": "Pizza Heaven",
"address1": "Kungsgatan 1",
"address2": "111 43 Stockholm",
"latitude": 59.336078,
"longitude": 18.071807
},
{
"id": 2,
"name": "Pizzeria Apan",
"address1": "LÃ¥ngholmsgatan 34",
"address2": "117 33 Stockholm",
"latitude": 59.315709,
"longitude": 18.033507
}
]
So does it mean that i have to manually re-assign each known property?
What does your JSON look like?
In the set variable node, using Power Fx, you could use a variation of this formula:
ForAll(
Topic.MyTable,
{
DisplayName: name,
OtherProperty: property,
ID: id
}
)