Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
PresidReporting
Contributor
Contributor

Help with store filename logic

Hi,

I have been tasked to store a QVD but with a very specific file name, example: FIleName - JUL 2021.

The month name is determined by the day number of month.  If the day number is less than 8 (i.e. the first 7 days of the month), the users want the filename to show the previous month name.  Day 8 and beyond would be the current month.  The year would show the year, however they want it in Fiscal Year.  Our Fiscal Year starts July 1.  So currently, we are in fiscal year 2021.

Examples of correct filenames:

If today's date is 7/8/2020, 'Filename - JUL 2021'

If today's date is 7/2/2020, 'Filename - JUN 2020'

If today's date is 10/15/2020, 'Filename - OCT 2021'

If today's date is 1/3/2020, 'Filename - DEC 2021'

If today's date is 1/8/2020, 'Filename - JAN 2021'

 

So two things to consider:  Our fiscal year, and the day number of the month.  A little confusing to wrap my head around.

Any easy advice?

 

 

1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

I created the variable below:

Let vMnthFiscalYear=If(Day(Today()) < 8,Month(AddMonths(Today(),-1)),Month(Today()))&'-'&If( Num(Month(Today())) >= 7 and Num(Month(Today())) <= 12,Year(Today()) + 1,Year(Today()));

Store Data into 'Filename - $(vMnthFiscalYear).qvd' (qvd);

View solution in original post

1 Reply
jwjackso
Specialist III
Specialist III

I created the variable below:

Let vMnthFiscalYear=If(Day(Today()) < 8,Month(AddMonths(Today(),-1)),Month(Today()))&'-'&If( Num(Month(Today())) >= 7 and Num(Month(Today())) <= 12,Year(Today()) + 1,Year(Today()));

Store Data into 'Filename - $(vMnthFiscalYear).qvd' (qvd);