cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rocko
Frequent Visitor

Setting variable values

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

GanCW_1-1613037778737.png

 

 

View solution in original post

7 REPLIES 7
Henrik_M
Resolver III
Resolver III

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
Rocko
Frequent Visitor

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!

sakula1996
Responsive Resident
Responsive Resident

Hi @Rocko , you can directly paste the @Henrik_M  code in PAD development canvas.

It will convert the above code to PAD actions.

 

sakula1996_0-1612733080603.png

 

Hope this helps 🙂

 

Rocko
Frequent Visitor

 

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_0-1612793827285.png

 

@sakula1996 ,

How to get to this development canvas ?

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

 

GanCW_1-1613037778737.png

 

 

View solution in original post

Rocko
Frequent Visitor

Thank you GanCW!  This got me what I was looking for.

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (53,620)