I do not know how to address this issue…
On my SAP automation I need to run same process many times…
A varbale “ID” 1,2,3
A varible “numberOfDays” is equal to either 1 day or 2 days
When the ID is 1 and the numberOfDay value is 1 … then is has to run the whole process and finish… and go to next ID.
when its reading next ID 2 and numberOfDay value is 2 … then same process have to run 2 time and in the first time it has to give value under SAP (Period) the last date to month (coming from SN) like “31.03.2020” finish and then it has to run the same process 2nd time but this time it has to give 2nd last date of month as “30,03,2020” and finished the process.
It look simple but im stuck on how i can replace the date in same process and do i need to use copy of whole process 2 time or what. can someone help.
We can use a WHILE Loop where we can set the counter value based on ID
That is like This
counter < Id
Where counter is a variable of type int32 with default value as 0 defined in the variable panel
And before while loop use a assign activity and define the value for counter as 0 before the current one is been processed in the while loop
And to reduce the date we can use a simple expression to reduce the initial date value one by one like this str_output = DateTime.ParseExact(datevalue.ToString,”dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddDays(-counter).ToString(“dd.MM.yyyy”)
Thank you sir While Loop is working…
But i still have issue with minus 1 day from the DATE…
secondLastDate is variable type String but have also tried with changing type to system.double but not working,
I cannot view your picture clearly, but strFratraedDatoSn is “31.03.2020” , right?
in that case, you have to use the format “dd.MM.yyyy” (format with point character), not “dd,MM,yyyy” (format with comma)
You were almost done
Mention the expression like this in assign activity second_LastDate= DateTime.ParseExact(strFratetedDate.ToString,”dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToString(“dd.MM.yyyy”)
I hope I would have misspelled name of the variable
Make sure you mention as per yours
This would work for sure
Kindly let for any queries or clarification