we have this formula in our MS Flow - Update Item task...
concat(items('Apply_to_each')['T_x002d_Code'] ,'-' ,items('Apply_to_each')['BoxNo'] ,'-' , items('Apply_to_each')['ID'])
but we need to add leading zeros to the BoxNo and ID so it ends up like this:
A02-00001-000235
How can we format those fields like that please?
Solved! Go to Solution.
Hi @livingstonep,
I have Produce 5 digits leading zero base on your box number length for your box number you can flow these steps to produced other leading zero numbers.
Set some variables
Use Do Until loop
COmpose and update values of your Variable to update string
Last Compose give you final value
output Starting Value is 1
OutPut End value is 00001
If you find this Helpful Please Accept it as Solution.
Thanks,
Harry_G
Hi @livingstonep,
I have Produce 5 digits leading zero base on your box number length for your box number you can flow these steps to produced other leading zero numbers.
Set some variables
Use Do Until loop
COmpose and update values of your Variable to update string
Last Compose give you final value
output Starting Value is 1
OutPut End value is 00001
If you find this Helpful Please Accept it as Solution.
Thanks,
Harry_G
Hi,
thanks so much for your truly excellent and very detailed answer
I ended up doing it in a similar way, but I used Switch Case in the Apply to each, then concatenated zeros that way using pre-defined padding variables
Hi livingstoneP.
Would you mind sharing your solution with us. I'm really struggling with getting this working at the moment.
Thank you in advance
Hi, we found an even better solution, and that is to use Substring and concat...
so we create the values we need in variables using substring and concat:
so basically we simulate the Right function using LEN and SUBSTRING in several steps...
and se end up with '00024' ...
the only alternative is to use a Switch case, or follow the answer above...
HTH
Philip
I got one more simple solution, only use 1 step:
Just put the Expression in the value of "Set Variable" step:
Just to clarify...
First, I need to Initialize variable with name: FormID, string value: 1
...then Set variable name: FormID, ID (for me its the SP ID)
...then when I Update item, in the my running number field I use
This can also be done with a simple formatNumber() function. Use the expression
Best value!
You can just use the "Format number" function this will return 0001 if the number 1 is inserted.
You can also use the formatNumber function -
concat(items('Apply_to_each')['T_x002d_Code'] ,'-' ,formatNumber(items('Apply_to_each')['BoxNo'],'00000') ,'-' , formatNumber(items('Apply_to_each')['ID'],'000000')
You can use format number
User | Count |
---|---|
91 | |
43 | |
19 | |
18 | |
15 |
User | Count |
---|---|
137 | |
54 | |
42 | |
41 | |
30 |