Question

Published parameter based on another published minus 1


Badge

Hi all

Im trying to super optimize a workbench I have that reads a bunch of data from a mssql database, the workbench has 2 published parameters that i use to set years in the "Where" clauses of readers. both parameters have years as values, the parameters are

$(year)

$(year_minus_1)

Is there any way to base the parameter $(year_minus_1) on $(year) and then minus one year. if the value of $(year) is 2017 the value of $(year_minus_1) should be 2016.

Is it possible to do this so you only have to input 1 parameter?

I know its not a big thing but it would make the running of the workspace every year easier for other people running it.


2 replies

Badge +2

You can use a python script parameter (year_minus_1) and set it like this:

previousYear = int(FME_MacroValues['year'])-1

return previousYear

Badge

You can use a python script parameter (year_minus_1) and set it like this:

previousYear = int(FME_MacroValues['year'])-1

return previousYear

Awesome, that did just the trick :)

Reply