Skip to main content
Solved

Transformer to check if on Form or Flow?

  • October 30, 2024
  • 6 replies
  • 87 views

arnold_bijlsma
Enthusiast
Forum|alt.badge.img+14

Hopefully easy question: what is the easiest way for me to check if a workbench is running on FME Form or on FME Flow?
On Form, when testing, I want to read the source data from my C-drive. But when on Flow, I want to read the official data uploaded on the server.

Best answer by nielsgerrits

Or use the FME parameter $(FME_ENGINE).

View original
Did this help you find an answer to your question?

6 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • October 30, 2024

You could use an EnvironmentVariableFetcher to fetch the COMPUTERNAME


nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • October 30, 2024

Or use the FME parameter $(FME_ENGINE).


arnold_bijlsma
Enthusiast
Forum|alt.badge.img+14
  • Author
  • Enthusiast
  • October 31, 2024

@ebygomm : That works, but it does require to hard-code the name of the server in order to distinguish it from any user machine. It wouldn’t be portable across different servers though (not that I had plans on doing so!)

@nielsgerrits : That was my initial solution as well: checking if any of the FME Flow Parameters has a value. The only issue was that if you check it, it exposes that flow parameter asking for a value at runtime. But I managed to avoid that by putting the AttributeCreator / ParameterFetcher inside an embedded custom transformer.
And because this solution distinguishes the software instead of the machine, it’s got my preference.

Thank you both!


nielsgerrits
VIP
Forum|alt.badge.img+54

Different approaches possible for this stuff. I know some use config files. We use a choice parameter for environment (Dev/Test/Prod) combined with scripted parameters and the parameter FME_ENGINE to do this. What this does is:

  • If workspace is run on fme server test, it uses the test parameter.
  • If workspace is run on fme server prod, it uses the prod parameter.
  • If workspace is run locally, it will use the environment choice to choose the parameter. (local, test or prod).

This way, you will never have to change anything in the workspace when publishing to test or prod, it will automatically choose the right parameter. Also, when developing, it is possible to easy switch between dev and test. And in the case of an issue, it is also easy to debug what is happening in prod.

Sample workspace attached.


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • November 1, 2024

@nielsgerrits - have you looked at using deployment parameters instead now they’re available? I’ve not had chance to fully test that approach yet


nielsgerrits
VIP
Forum|alt.badge.img+54
ebygomm wrote:

@nielsgerrits - have you looked at using deployment parameters instead now they’re available? I’ve not had chance to fully test that approach yet

No not yet, I’m not sure when this was introduced but I believe our server version is not new enough for it. Also our current approach works really well for us.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings