Hi @arkiboys , how have you been? Let me see if I understand this one right, I think it looks fun.
You already have a string-building expression, and want to use that logic inside a loop so it repeats with smaller and smaller input value until to reaches now. Kind of like
Language C:
integer inputValue = -365;
for( inputValue ; inputValue = 0 ; inputValue = inputValue + 30 )
buildMyString( inputValue );
Language Python:
inputValue = -365
while inputValue < 0 :
buildMyString( inputValue )
inputValue = inputValue + 30
For these situations, I have a couple tricks.
- Divide pdaysBack by pBatches to find out how many batches we need (pNumBatches).
- use
range( 1 , pNumBatches )to generate a series ( 1, 2, 3, 4, 5 ... pNumBatches). - Feed this series into a ForEach loop. Inside the loop an AppendVariable activity will multiply each item by pBatches, and append it to a new list variable. This may re-order things unless you do sequential.
- Back in the main pipeline, I feed this modified series to another ForEach loop which gives each item to your stringBuilder. The stringBuilder can use another AppendVariable
- Once that loop is finished, we have an array of strings, just need to
join()them together in Set Variable and done!