cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Unique ID like 2019-01 with condition don't count other line items

I have a flow that creates a unique ID with the year 'yyyy' format, like 2019-01.

As last step, I entered the condition, that a column of my list has to contain a specific word.

The problem is that it then looks like this. After 2019-34 comes 2019-38. What I would like to have, is that after 2019-34 comes 2019-35.

 

074.JPG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Dricc, forgive me for stepping into your conversation with @ErichH  but I have an alternative method in the images below which I hope you will find is a solution. The main thing is that whenever I deal with incrementing values I always save the inext value to be used, i.e the 35 you mentioned in yur first post, in a separate SharePoint list which only has that 1 item. The flow gets that number, updates the new item with it then then adds 1 to it at the end of the flow ready for the next item that meets the Condition.

In my example the Condition must be that Current is equal to Yes.

Image 5: as the number has been used in a string variable we need to convert it back to an integer ready to be saved to the increment list.

If the Condition evaluates to No then the number is not increased by 1, You can see this in the last image.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

1-Trigger - get item1-Trigger - get item2-Compose Year Init variable2-Compose Year Init variable3-Get increment value to be used3-Get increment value to be used4-Condition and update item4-Condition and update item5-Convert to integer5-Convert to integer6-add 1 to the increment value6-add 1 to the increment value7-Next increment value to be used if condition is yes7-Next increment value to be used if condition is yes8-Current list with generated values8-Current list with generated values

 

 

 

View solution in original post

17 REPLIES 17
Helper IV
Helper IV

My flow looks like this. I don't know if it helps.

 

083.JPG

Are you sorting the data in the “get items” step by “ID”?

 

and 

 

Why is the “increment variable” step outside of the loop “apply to each”? What is inside of the loop?

Thank you @ErichH !

Please find my flow below. Does it help?

 

084.JPG085.JPG086.JPG087.JPG

you have to

> move the "increment variable" step into the "apply to each" loop as you want to have unique numbers.

 

and 

 

suggest to add in "Get items" in 

> "order by" the dynamic variable ID .

> "filter by" the text  generated%20number ne  ''

 

Thanks a lot @ErichH !

just one question: what does this do and what is the dynamic variable exactly:

"order by" the dynamic variable ID

 

Also, the flow runs succesfully, but doesn't do what I want:

 

 

088.JPG089.JPG090.JPG091.JPG

Hi @Dricc, forgive me for stepping into your conversation with @ErichH  but I have an alternative method in the images below which I hope you will find is a solution. The main thing is that whenever I deal with incrementing values I always save the inext value to be used, i.e the 35 you mentioned in yur first post, in a separate SharePoint list which only has that 1 item. The flow gets that number, updates the new item with it then then adds 1 to it at the end of the flow ready for the next item that meets the Condition.

In my example the Condition must be that Current is equal to Yes.

Image 5: as the number has been used in a string variable we need to convert it back to an integer ready to be saved to the increment list.

If the Condition evaluates to No then the number is not increased by 1, You can see this in the last image.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

1-Trigger - get item1-Trigger - get item2-Compose Year Init variable2-Compose Year Init variable3-Get increment value to be used3-Get increment value to be used4-Condition and update item4-Condition and update item5-Convert to integer5-Convert to integer6-add 1 to the increment value6-add 1 to the increment value7-Next increment value to be used if condition is yes7-Next increment value to be used if condition is yes8-Current list with generated values8-Current list with generated values

 

 

 

View solution in original post

Thank you @RobElliott !

That looks pretty good exept for the last part where the sister list is updated. I get following error:

 

092.JPG093.JPG

 

The error message says the item doesn't exist. You must already have an item in that list.

Rob
Los Gallardos

@RobElliott, I do have an item in my list:

 

094.JPG095.JPG

Could you post of screenshot of the Update item action that failed so we can what the issue might be in it.

Rob
Los Gallardos

It looks to me like you've changed the list name from Trial2_sister to x4requests_sister? That might be the problem as Flow (and PowerApps) doesn't like it when list names, column names etc are changed. You could delete the connection and re-connect or perhaps delete and re-create the actions that refrence the sister list.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Sorry I had created a copy of the flow, to test it on other lists that I have. This was the screenshot of this copy.

Here the original: I never changed the list name:

 

100.JPG

Note that I was obliged to enter something in the 'Title' column of list Trial2_sister because this column is required by default. I don't know if this can be an issue.

No that won't be the problem. For some reason it doesn't seem to be finding the list and I'm not sure why that would be happening.

Rob
Los Gallardos

@RobElliott  it works now! I had the ID wrong. I had @{body('Update_item')?['ID']} instead of the @{items('Apply_to_each_2')?['ID']}

Thank you very much for your help all along.

@Dricc, excellent! I'm pleased it works for you.

Rob
Los Galardos

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (50,509)