Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gayatri7
Creator II
Creator II

Current Period and Previous Period in the script

Hi All,

I have a period column which contains value like 201708,201709,201710 etc.

I have to extract the value from another file based on the current period only.

Eg. In file A I have Period columns contain 201708,201709,201710 etc. where as in file B I have entire history details and need to extract only the data for Current month. and for some related to previous month

I have created a variable as shown below

vCurrentYear: Left([PERIODO],4)

vCurrentMonth: Right([PERIODO],2)

vPreviousYear: Left([PERIODO]-1),4)

vPreviousMonth: Right(([PERIODO]-1),2)

For Previous month and year variable is not working at the script level where as it is working fine in text object.

And Can anyone confirm me whether it is the right approach or not?

and will variable values in the script will change automatically when period value changes .

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try these:

vPeriod = Date#(PERIODO,'YYYYMM')

vCurrentYear = Year($(vPeriod))

vCurrentMonth: Month($(vPeriod))

vPreviousYear: Year($(vPeriod))-1

vPreviousMonth: Month(MonthStart($(vPeriod),-1))

and will variable values in the script will change automatically when period value changes

Yes. if you calculate the variables in the script then they will be change during reload when the source data contains new data


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Try these:

vPeriod = Date#(PERIODO,'YYYYMM')

vCurrentYear = Year($(vPeriod))

vCurrentMonth: Month($(vPeriod))

vPreviousYear: Year($(vPeriod))-1

vPreviousMonth: Month(MonthStart($(vPeriod),-1))

and will variable values in the script will change automatically when period value changes

Yes. if you calculate the variables in the script then they will be change during reload when the source data contains new data


talk is cheap, supply exceeds demand
Anil_Babu_Samineni

Are you going call variables into Field ?? Where and what is not working for you?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
gayatri7
Creator II
Creator II
Author

Thank you so much for your response!!!