Skip to main content

I have several SQL executors spread across a large number of workbenches which I am now moving from the the Development to the Production environment, for this reason I have to change (hopefully in a clever way) the connection strings for every SQL transformer. In order to make it easy and only have to change one parameter I am trying to make the DB connection as a published parameter. There is a parameter text called "Environment" that can either be "development" or "production" this is in turn liked to a conditional value for the parameter "db connection" that should tell the SQL transformer (i.e. SQLExecutor, SQLCreator, etc) which db connection to open. In order to do it I followed the example shown in this answer:

https://knowledge.safe.com/questions/34324/database-connection-as-publish-parameter-of-a-cust.html

Unfortunately the mechanism does not work, when the workflow hits the conditional value FME (both server and desktop) instead of reading the result of the expression it reads the text of the expression itself (in the internal language that maybe FME use to resolve the conditional statement) see attached.

Is it something I am doing wrong or is it a problem with FME? I have seen quite a few of this "parsing" problem in other places (i.e python scripts, FMEJob submitters). Could anyone help?

Hi @alex_chris, Can you tell us what version of FME you are using? We'll try to reproduce the problem you are seeing.

 


I think there are a couple of ways to achieve what you want.

Firstly I assume the development and production environments are separate machines. In that case I would simply create a connection on the development machine (eg called MyFMEConnection) which points to the development database. Then I would create a connection on the production machine. I would give it the same name (MyFMEConnection) but point it to the production database.

That way when you move a workspace from dev to production (or from production to dev) there is no need to do anything. The workspace will pick up and use the connection with that name, and be pointed to the correct db.

If you wanted to make it so a user could choose the connection, then you would create a user parameter. Wherever the workspace references a database connection it would need to be set to that user parameter. Then when you move the workspace to the production environment, you only need to pick the connection from the published parameters.

I would go with the first option, because then the workspace is set up automatically and the user doesn't have to pick a connection when running it, so there is no chance they could pick the wrong connection.

I did look and I can't see any way to create a conditional selection of database connection. The Conditional setting just isn't there...

Can you upload a screenshot to show where you are selecting the conditional option?

Mark


Reply