Skip to main content
Solved

Custom transformers reading workspace name


Forum|alt.badge.img
I want to include the workspace name as part of some metadata I generate

 

 

 

Running the workbench as a workspace the $(FME_MF_NAME) variable returns my workspace name Once I convert it to a custom transformer (CT)  this variable returns the fmx name rather than the calling fmw name

 

 

I set a published parameter to the value of the $(FME_MF_NAME)  in the CT

 

Running as a Linked CT I get the following error

 

 

 

Starting translation...

 

 

Undefined macro `ArcGIS_MetaItemDescription_FME_MF_NAME' dereferenced in file `C:\\Users\\scooter\\Documents\\FME\\Transformers\\ArcGIS_MetaItemDescription.fmx'

 

Program Terminating

 

 

Translation FAILED.

 

 

 

Running as an embedded CT I get the correct result

 

 

 

When I embed and run it using a private parameter I get the same error

 

 

Starting translation...

 

 

Undefined macro `ArcGIS_MetaItemDescription_FME_MF_NAME' dereferenced in file `C:\\Users\\scooter\\Documents\\My FME Workspaces\\wb-xlate-1399417605939_8048'

 

Program Terminating

 

 

Translation FAILED.

 

 

 

I really would prefer  to use this as a linked CT using a private parameter

 

 

Pretty inexperienced in terms fsuing CT and passing parameters so hoping someone can help

 

 

Thanks

 

Brian

Best answer by david_r

Hi,

 

 

not sure this is doable since the .fmx basically is like its own workspace (if my understanding is correct).

 

 

However, I suggest you use the following snippet in a PythonCaller inside your custom transformer to dump all available macro values to see if any of them fits your needs:

 

 

-----

 

import fmeobjects

 

import pprint

 

 

def showAllMacroValues(feature):

 

    pp = pprint.PrettyPrinter(indent=4)

 

    pp.pprint(FME_MacroValues)

 

-----

 

 

David
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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

david_r
Celebrity
  • Best Answer
  • May 7, 2014
Hi,

 

 

not sure this is doable since the .fmx basically is like its own workspace (if my understanding is correct).

 

 

However, I suggest you use the following snippet in a PythonCaller inside your custom transformer to dump all available macro values to see if any of them fits your needs:

 

 

-----

 

import fmeobjects

 

import pprint

 

 

def showAllMacroValues(feature):

 

    pp = pprint.PrettyPrinter(indent=4)

 

    pp.pprint(FME_MacroValues)

 

-----

 

 

David

Forum|alt.badge.img
  • Author
  • May 8, 2014
Hi David,That exposed a master name that i could use to get the job done.  THanks for your help

 

 

feature.setAttribute("_metaWorkbench", FME_MacroValues['FME_MF_NAME_MASTER'])

 

 

cheers

 

Brian

 

 

 

 


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