cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tobiwan
Advocate III
Advocate III

Create Expression form user input/variable

Hi everyone


I'm in the middle of building a flow, but somehow I'm not getting it right. Maybe you can help.


Idea of the flow

User will provide:

  • an Excel-File
  • and the name of the column that needs to be extracted from a table -> variable VarStrExpression

the flow then

  • extracts the named column (stored in VarStrExpression) form the table
  • and afterwards does something with the extracted data in dataverse. e.g. update the record with the same Titel/or better an ID

Inside the flow I get all rows of the excel file into an array. column names Titel, Ist, Problem, ...

ArrayArray


Lets say, I want to extract the column "Titel" from this array, I can do it with a Select action

2021-06-01_17h26_03.png

It all works fine if I hard code the column/property name in the items expression as item()?['Titel']

2021-06-01_17h27_03.png

 

But how do I change the item expression dynamically based on the column name provided by the user / stored in a variable. Is that possible?

 

I tried the following expressions:

  • item()?[string(variables('VarStrExpression'))]
  • item()?[variables('VarStrExpression')]
  • item()?['variables('VarStrExpression')']

They either result in empty array values or in errors when trying to save the flow.

 

Any help to get this running is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Tobiwan 

 

Because its an array you need to specify the For Each Loop in your expression. Please see below

 

image.png

image.png

 

Above expression is as follows:

items('Apply_to_each')?[outputs('Compose_3')]

 

My Test Result

 

image.png

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

3 REPLIES 3
abm
Super User
Super User

Hi @Tobiwan 

 

Because its an array you need to specify the For Each Loop in your expression. Please see below

 

image.png

image.png

 

Above expression is as follows:

items('Apply_to_each')?[outputs('Compose_3')]

 

My Test Result

 

image.png

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

Tobiwan
Advocate III
Advocate III

@abmThanks for your reply. You solved my problem partially. The for each was not necessary. The "Select" action does work and usually works faster than "for each".

But instead of "variable" I used "compose" as you suggested, and now it works just fine.

I use "select" to extract the column from a excelfile. The flow user has to name the desired column previously. The input given by the user is passed to a compose action and the compose result in the select action.

 

2021-06-28_08h11_04.png

 

 

2021-06-28_08h11_23.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,860)