I have a flow which adds a new row to a dataverse table called "Projects."
I need to populate one of the new fields in the Projects table with the next available incremental number from the column "Master Project #"
I can retrieve the max number in the column "Master Project #" by using "List Rows" and sorting by the column in descending order & using a row count of 1.
My trouble is that I then need to insert this number into the "new row" step without turning it into a "for each" step.
Is there a better way to retrieve and use the highest number in the "Master Project #" column plus one?
Thank you so much @abm
After searching around, I seem to have found the right syntax, which was as follows:
@{outputs('List_Master_Project_Number')['body']['value'][0]['cra6a_masterproject']}
Thanks so much for setting me on the right path!
Hi @BertP
Could you post a screenshot of your flow please? Since your using the List rows with row count 1 it will always put the loop even though it contains one record hence I suggested the expression.
Is here 'name' is your column, which is your incremental column?
outputs('List_Master_Project_Number')?['body']?[0]?['name']'
You mentioned have a "for each" step because the flow ultimately will only be adding a single record/row (it depends on a single row JSON output from powerapps for adding a single row).
Could you please explain the above?
outputs('List_Master_Project_Number')?['body']?[0]?['here replace your incremental column']'
Thanks
thx @abm
I'm not sure I explained the difficulty well enough. I am trying to retrieve the max value (whole number) of the column "Master Project #" plus 1 in a way that I can use a single number output. My problem is that when I put in any references to the "List Rows" step, PA creates a "for each" step. I can't have a "for each" step because the flow ultimately will only be adding a single record/row (it depends on a single row JSON output from powerapps for adding a single row).
I tried the code you had above, but receive the following error: " 'outputs('List_Master_Project_Number')?['body']?[0]?['name']' cannot be evaluated because property '0' cannot be selected. Object properties can only be selected by names."
Hi @BertP
Yes you can specify the index try the below
outputs('List_rows')?['body/value']?[0]?['name']
Note: When you use "List Rows" and sorting by the column in descending order & using a row count of 1. This will return the latest record you created. So better to add another filter query to extend using the incremental number column not equal to zero or something. This will give you the second last record not the very latest record. Not sure this is the logic you want but I just want to mention that and it may be helpful.
Michael E. Gernaey
179
Super User 2025 Season 1
David_MA
161
Super User 2025 Season 1
stampcoin
143