Hi @ari, can the EnvironmentVariableFetcher transformer help you?
Hi
Are you using the EnvironmentVariableFetcher?
Be aware that environment variables defined while a program (e.g. FME) is running won't be available to that program until it restarts.
David
Use ${variablename} and that should work, for example: ${ENVIRONVAR}\\dat\\myfile.txt
Thks Takashi, David & Mark for your anwers !
@Mark, I don't understand the reason but this solution doesn't work. I think it's the most logical way to do it and It was the first thing that i tried but I get this error message:
Undefined macro `ENVIRONVAR' dereferenced in file `file.fmw'. Program Terminating
@Takashi, @David, I haven't used before the EnvironmentVariableFetcher transformer, I would take in consideraton for future ocassions.
Finally, I solved the problem with a Private Scripted (Python) Parameter (myparam) that gets the value of the environment variable:
import os
return os.environe'ENVIRONVAR']
and then using this parameter in that way ... $(myparam)/dat/file.dat
Clearly, this is a workaround to do the same that i think it would have to do the direct assign of the environment variable :(
Thanks,
A.
Thks Takashi, David & Mark for your anwers !
@Mark, I don't understand the reason but this solution doesn't work. I think it's the most logical way to do it and It was the first thing that i tried but I get this error message:
Undefined macro `ENVIRONVAR' dereferenced in file `file.fmw'. Program Terminating
@Takashi, @David, I haven't used before the EnvironmentVariableFetcher transformer, I would take in consideraton for future ocassions.
Finally, I solved the problem with a Private Scripted (Python) Parameter (myparam) that gets the value of the environment variable:
import os
return os.environe'ENVIRONVAR']
and then using this parameter in that way ... $(myparam)/dat/file.dat
Clearly, this is a workaround to do the same that i think it would have to do the direct assign of the environment variable :(
Thanks,
A.
That's odd @ari - are you sure you were using curly braces {} and not round ones ()
The curly braces not working at 2017.0
So, I needed to restart services after creating environment variable. Sorry.
Hi @mark2atsafe Thanks for this tip....this works well within the engine...but the environment variables in paths doesnt quite work within workbench for example when the FeatureReader wants to scan the dataset the environment variable in a path does not resolve.
Hi @mark2atsafe Thanks for this tip....this works well within the engine...but the environment variables in paths doesnt quite work within workbench for example when the FeatureReader wants to scan the dataset the environment variable in a path does not resolve.
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
Has this "limitation" be address? Which approach is considered a FME developer "best practice", 1) EnvironmentVariableFetcher or 2) inline reference ${variablename}?
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
Unfortunately, no. The management team told me that this isn't meant to be supported, which is a shame. Given that, I think the EnvironmentVariableFetcher transformer is perhaps the best practice solution. It's an extra transformer to add, but it is the most guaranteed to work.
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
@mark2atsafe ; @david_r
i have trouble using variable environmental in feature writer transformer:
in dataset i use : ${KMOCShape}\\Facilities. I doesn't work. please advise. thanks. - it actually creates a folder ${KMOCShape}\\Facilities at the same location of its workspace.
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
If you're referring to a published parameter, you have to use parenthesis, not brackets. For example:
$(KMOCShape)\Facilities
If you're indeed referring an OS environment variable, I'd try using an EnvironmentVariableFetcher before the writer and using its output attribute in the writer path.
fyi for everyone following this, I've filed the issue of environment variables in the FeatureReader (FMEENGINE-60160) and we'll wait and see what the developers can do for us.
Thanks @david_r !! using parenthesis, i has the same issue as using brackets. it works with EnvironmentVaribaleFetcher. Thanks again!