Is there a way to set a variable to a value using a function or formula in PAD? For example, I want to create a variable named BeginDate that is set to the first day of the previous month and then another variable named EndDate to be the last day of the previous month. These would then be used to pass to a reporting application as the date range to run report with.
Thanks.
Solved! Go to Solution.
Rocko,
You can accomplish this in PAD.
1. Get current date
2. Last day of the prev month = current date - day number
3. New date = current date - 1 month
3. First day of the previous month = new date - day number + 1
No. There are no functions or formulas. You need to do it with actions. Try pasting this code into your flow:
Display.SelectDate DateDialogFormat: Display.DateDialogFormat.DateOnly IsTopMost: True SelectedDate=> SelectedDate
Text.ToDateTime Text: $'''01-%SelectedDate.Month%-%SelectedDate.Year%''' DateTime=> TextAsDateTime
DateTime.Add DateTime: TextAsDateTime TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> EndDate
Text.ToDateTime Text: $'''01-%EndDate.Month%-%EndDate.Year%''' DateTime=> BeginDate
Thank you for the reply. I am new to Power Automate/PAD and struggling to try to get what I think are basic things to work. I am currently evaluating this tool as a cheaper option than my current RPA solution.
Where exactly would I paste this code? I am working entirely in the desktop app. All the searching I have done has shown using functions/expressions in the web interface. Am I even wrong in assuming that everything can be done in the desktop app? I am on the verge of giving up and just writing this off as being overly complex compared to my current tool. As an example, my current tool already has predefined date variables ("FirstDayPriorMonth", "LastDayPriorMonth",etc). All I have to do is send those as inputs to my SSRS report parameters and then have it click "View Report" and all is good.
Thanks again for the help!
Thanks again Henrick_M....this gets me half way there. The End Date (last day of prior month) is the same as the Begin Date. I have done my best to figure out how to manipulate the logic you provided but I am not having any luck.
Rocko,
You can accomplish this in PAD.
1. Get current date
2. Last day of the prev month = current date - day number
3. New date = current date - 1 month
3. First day of the previous month = new date - day number + 1
Thank you GanCW! This got me what I was looking for.