Hello everyone
I am trying to do the following:
My workspace writes into a database. I have set a user parameter to give the user an option “delete Database and start a fresh database OR continue adding data onto existing data”. In case of deleting the Database the creation of IDs (which are created in the Process) should start at 1. In case of adding data to the existing database the creation of IDs should continue from whatever the max value already existing in the database is.
I believe this should work as follows using a YES/NO User Parameter.
Test Filter on that User Parameter:
YES → Sampler (create single initiator) → SQL Executor (delete all data with “delete from tables”)
NO → Sampler (create single initiator) → Feature Reader on Database → Statistics Calculator (extract max ID)
Now in a different path within the workspace I have a Counter which I use to create the IDs. I thought I could simply use a conditional Value set on my YES/NO User Parameter with
YES → Start at 1
NO → Start at max ID as extracted from the Statistics Calculator above +1
The last step (NO) is where I am having trouble. How can I use that value in my counter transformer without adding attributes? I fiddled around with User Parameters and global variables but I’m not sure thats the way to go. Ideally I would like to cache that value and call it in the Count Start Parameter as $(max_ID) on the Condition the the User Parameter is set to NO.
I guess I could join the values before getting to the counter but that A) seems a bit excessive and B) could make problems since in case of YES there will be no output and that Feature Joiner might halt the whole Process without an Input?
What am I missing?