Skip to main content
Question

Published parameter based on another published minus 1

  • March 15, 2018
  • 2 replies
  • 33 views

Forum|alt.badge.img

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

lau
Forum|alt.badge.img+3
  • March 15, 2018

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

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

return previousYear


Forum|alt.badge.img
  • Author
  • March 15, 2018

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 :)