cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nich3play3r
Advocate II
Advocate II

Need current fiscal year int to pass as parameter value to paginated report

Hi.

 

I have a flow that executes a paginated report. The report has 2 parameters, one of which is FiscalYear. I'm trying to create an expression to give me the current fiscal year as an integer, but I keep getting errors. Here's what I currently have:

 

if(int(formatDateTime(utcNow(),'MM')) > 6, int(formatDateTime(utcNow(),'yyyy')) + 1, int(formatDateTime(utcNow(),'yyyy')))

 

Maybe I need to pursue a different strategy? Thanks for any thoughts you may have!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

You are pretty close to the solution. Just replace > and + by the greater and add functions. You can also remove the formatdatetime and directly put the format within the UtcNow function

 

Try the expression below instead:

 

 

if(greater(int(utcNow('MM')), 6), add(int(utcNow('yyyy')), 1), int(utcNow('yyyy')))

 

 

 

fiscalyear.png

View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

You are pretty close to the solution. Just replace > and + by the greater and add functions. You can also remove the formatdatetime and directly put the format within the UtcNow function

 

Try the expression below instead:

 

 

if(greater(int(utcNow('MM')), 6), add(int(utcNow('yyyy')), 1), int(utcNow('yyyy')))

 

 

 

fiscalyear.png

Thank for you for this, @Expiscornovus . This value is such a common need for me, I should really take the time to document its creation across all the languages I'm frequently dabbling in. Also, a follow up, if you have time:

 

I see you're doing this as an variable. I went straight for a Compose step, though I suppose I could also simply add your expression directly into my ParametervaluesValue box in my Export to File For Paginated Reports step. Would initializing a variable still be your recommedation, given these other options?

 

Thank you again for your time and your clear, concise answer.

Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

Yes, you should be able to use the expression directly into the parametervalues box/field.

 

You do not need a compose or initialize variable action. My screenshot was just an example 😁

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,024)