Hi @rtics
Based on your form.
1. You set the row amount in each Repeating Section. Submit Form
2. Workflow runs. Creates the Running Numbers. (Note that I'm not using the keyword ID as you did. In SPO, ID is a system generated field).
3. The Running Numbers value is then saved into a SPO Multiple Line column.
4. Your Form display the Running Numbers in a Text-Long field (as show in your form)
What you want to accomplish?
1. When users update the row amount in the Form, you don't want the Workflow to regenerate all the numbers again, right?
2. You stated that users are able to increment the row amount (to add more Running Numbers). Can users decrease the row amount?
The solution logic
1. Add 2 more controls to the Repeating Section. A Yes/No toggle and a Long-Text field
2. The Yes/No toggle is a boolean value. If value is equal to YES, then generate the Running Numbers for this particular row. Save it to the Row Running Numbers field. Otherwise do nothing.
3. You will need to track the amount of numbers to add. You can have 2 Quantity Numbers. The Current QTY should be read-only. The New Qty. Then you only process to add the amount specified in New Qty. or you can count the lines in the Row Running Numbers.
4. The Row Running Numbers control. Show it during Testing/Development. Hide it later
5. Process each row where Regenerate toggle is Yes.
6. Once all the rows have been processed. Join all the Row Running Numbers into one large RUNNING NUMBER.
Output Form
Let me know if you do not understand any portion of this or where you are facing any issues.
Hi Garrett,
Thanks! This seems to be a good solution. Though I am a bit confused with the row regeneration. I want to be able to retain the existing Running Numbers and at the same time, add new ones but the increment should start after the last count of the last row.
I hope this makes sense to you. Please see sample output below. Kindly take note of the 2 added quantities in batch 1.
Sample Output:
Batch 1 (added another 2)
2201294156000901,
2201294156000902,
2201294156000903,
2201294156000904,
2201294156000905,
2201294156000906,
2201294156000909,
2201294156000910,
Batch 2 (no change)
2201294156002407,
2201294156002408,
Hi @rtics
Ah ha! I see what you mean...
What does your number represent
2201294156000901 - Refer to YYMMDD. 4156 means something...
2201294156000901 - Refers to Batch ID?
2201294156000901 - a checksum value?
2201294156000901 - Serial running number.
Whatever it is, I should only be concern with this last 2 digit, right?
Sample Input 1:00 AM
2, 2 (Each row)
Sample Output 1: 01 AM
---| Row 1 Running Numbers|---
2201294156000901,
2201294156000902,
---| Row 2 Running Numbers|---
2201294156002403,
2201294156002404,
---| FINAL Running Numbers|---
2201294156000901,
2201294156000902,
2201294156002403,
2201294156002404,
---| Var Count == 4 |---
Sample Input 2:00 AM
2, -N/A-, 2 (Each row)
Sample Output 2:01 AM
---| Row 1 Running Numbers|--- (Add 2)
2201294156000901,
2201294156000902,
2201294156000905, (New)
2201294156000906, New
---| Row 2 Running Numbers|--- (No Change)
2201294156002403,
2201294156002404,
---| Row 3 Running Numbers|--- (New Row, Add 2)
2201294156003307, (New)
2201294156003308, (New)
---| FINAL Running Numbers|---
2201294156000901,
2201294156000902,
2201294156000905, (New)
2201294156000906, New
2201294156002403,
2201294156002404,
2201294156003307, (New)
2201294156003308, (New)
---| Var Count == 8 |---
Sample Input 3:00 AM
3, -N/A-, -N/A-
Sample Output 3:01 AM
---| Row 1 Running Numbers|--- (Add 3)
2201294156000901,
2201294156000902,
2201294156000905,
2201294156000906,
2201294156000909, (New)
2201294156000910, (New)
2201294156000911, (New)
---| Row 2 Running Numbers|--- (No Change)
2201294156002403,
2201294156002404,
---| Row 3 Running Numbers|--- (No Change)
2201294156003307,
2201294156003308,
---| FINAL Running Numbers|---
2201294156000901,
2201294156000902,
2201294156000905,
2201294156000906,
2201294156000909, (New)
2201294156000910, (New)
2201294156000911, (New)
2201294156002403,
2201294156002404,
2201294156003307,
2201294156003308,
---| Var Count == 11 |---
Is this correct?
Then during each row process, if Toggle is YES. then process
You will need a way to keep track of the quantity of running number (Count) Another hidden control at the end of the form, perhaps?
For 3:01 AM update, Row 1 to add 3 numbers. Running number to start after (Count which is currently the value of 8) 09, 10, 11
Update value of Count (11)
If there was a forth row to update at 3:01 AM,
So the INPUT is [3, -N/A-, -N/A-, 5]
Row 4 to add 5 numbers. Running number to start after (11) - 12,13,14,15,16
---| Row 4 Running Numbers|--- (Add 5)
2201294156005512,
2201294156005513,
2201294156005514,
2201294156005515,
2201294156005516,
Did I get your enquiry right? Is this solution workable for you?
Again, let me know if you do not understand any portion of this or where you are facing any issues.
Hi @rtics
Ah ha! I see what you mean. Use a hidden control to keep track of total running numbers.
When you process a row, just add the next running number (and update the total)
Sample Input 1:00 AM
2, 2
Sample Output 1.01 AM
Batch 1 (Add 2)
2201294156000901,
2201294156000902,
Batch 2 (Add 2)
2201294156002403,
2201294156002404,
Sample Input 2:00 AM
2, -n/a-
Sample Output 2.01 AM
Batch 1 (Add 2)
2201294156000901,
2201294156000902,
2201294156000905,
2201294156000906, (Update the Total)
Batch 2 (no change)
2201294156002403,
2201294156002404,
Below should be the correct sample input at 2:00 AM. I am not sure what actions are needed if this will be processed in Nintex Workflow.
Sample Input 1:00 AM
2, 2
Sample Output 1.01 AM
Batch 1 (Add 2)
2201294156000901,
2201294156000902,
Batch 2 (Add 2)
2201294156002403,
2201294156002404,
Sample Input 2:00 AM
4, 2
Sample Output 2.01 AM
Batch 1 (Add 2)
2201294156000901,
2201294156000902,
2201294156000905,
2201294156000906,
Batch 2 (no change)
2201294156002403,
2201294156002404,
@rtics
1. You will process the List Item whenever Items are create (NEW) and When Items are modified (EDITED)
2. I have given you a basic Pseudocode for the Workflow Logic.
The FORM
FORM
REPEATING ROWS
[int]Quantity // Text field existing
[int]QuantityNEW // Text field New
[bol]Regenerate // Yes/No Toggle. Needed during Edits. Hide when New Form
[txt]RowRunningNo // Long-Text to store Generated Numbers. Initially Empty
[txt]RunningNo // Long-Text. Result of joining all the RowRunningNumber.
[int]QtyGenRunNo // Store total of generated number
The WORKFLOW
Get QtyGenRunNo ; //Number of Generate Rows. If NewForm then equals 0
ForEach LOOP:
Get Repeating Row Data - [int]QuantityNEW
LOOP: [Loop for QuantityNEW times]
PROCESS [Generate your Running Numbers]
ADD 1 to QtyGenRunNo //QtyGenRunNo++
APPEND QtyGenRunNo to [Your Generated Running Numbers] //00000[00]
END-LOOP:
UPDATE QtyGenRunNo value to SP
UPDATE RowRunningNo value to SP
END-ForEach LOOP:
JOIN RowRunningNo(s) INTO RunningNo
UPDATE RunningNo
Workflow Actions
Query XML - Get data from Repeating Rows, Store into Collection Variable
For Each Loop - Process Collections
If you are stuck with the workflow, just let me know here.
Copy and paste the workflow diagram and the results which you got.
Hi Garrett,
Thank you for your help. I have been trying to implement your suggestion but I am stuck with the rendering of the Row Running Numbers.
As you may have noticed, I have to display the serial numbers in vertical order. And by doing that, I had to use some html tags to achieve that. However, they do not render well in text fields when inside the repeating section. It might be because the output of repeating section is in XML format. The output of Row Running Number text field becomes an object.
Hope you could give some advice.
Hi @rtics
So,frget about formatting the RowRunningNumber in the Repeating Section.
Just use a comma or semicolon and append new values. Remember that this control shall be hidden on the form.
2201294156000901,2201294156000902,
When you join all the RowRunningNumber, store it into a FINAL variable.
Do a search and replace with the Replace Substring in String control on the FINAL variable.
Find comma or semicolon, Replace with '<r>'
Display the FINAL variable in the RunningNumber control at the end of the form
JOIN RowRunningNo(s) INTO RunningNo variable
Search and Replace COMMA with NEWLINE
UPDATE RunningNo
Hope that manages to resolve the issue. If YES, pls click
I appreciate if you could click the orange hand icon in the Kudos box
Hi Garrett, sorry for getting back late. Unfortunately we did not push through with this functionality due to its complexity. But I really appreciate your help on this.
Hey @rtics No worries
I enjoyed stretching and exercising my brains on your issue.
Cheers