I'm working on a flow to read a user list from Excel and import into power app dataverse table. The Excel contains text where I need to map to the corresponding choice for Choice data type fields. For example, Excel gender will be Male, Female. In dataverse, the field would be mapped to the matching choice Male, Female. The flow edit screen shows a dropdown asking to choose which choice. I need a dynamic expression that will default the choice to Male if the Excel text is Male.
Currently I would have to set a static Variable Object with hardcoded choice IDs but this is cumbersome especially when it comes to Choices list with a lot of options.
Gender
{
"Male": "922610000",
"Female": "922610001",
"Other": "922610002"
}
then use the expression
if(not(empty(outputs('Get_response_details')?['body/r59896276b4f44249a311f6d93d7703a7'])), variables('Gender)[outputs('Get_response_details')?['body/r59896276b4f44249a311f6d93d7703a7']], null)