Question

GUI DYNAMIC_MULTI_SELECT_COMMAS and undefined macro

  • 22 February 2016
  • 3 replies
  • 1 view

Badge

Hi,

in my reader, I use the GUI TYPE "DYNAMIC_MULTI_SELECT_COMMAS" [1] so a user can selects/types some values. The sections in my metafile are:

DEFAULT_MACRO HOST localhost
DEFAULT_MACRO PORT 8080

! ...some more code

DEFAULT_VALUE HOST $(HOST)
GUI STRING HOST Host:

DEFAULT_VALUE PORT $(PORT)
GUI RANGE_SLIDER PORT 0%65535%0%OFF Port:

DEFAULT_VALUE LAYERLIST $(LAYERLIST)
GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST HOST,$[HOST],PORT,$[PORT] Layer Names:

This works fine, but  whenever I start a translation, I get the error:

Undefined macro `HOST_MYREADER_1' dereferenced in file `C:\Users\User\AppData\Local\Temp\wb-xlate-1456160185578_8088'

Program Terminating
Translation FAILED.

caused by $[HOST] in the DYNAMIC_MULTI_SELECT_COMMAS line. I can fix this by generating a Published Parameter called HOST_MYREADER_1 in my workspace, but I would like to understand the error. What is the problem here? I have created a macro called Host (and Port), why does FME crashes here?

Another solution is  

DEFAULT_VALUE LAYERLIST $(LAYERLIST)
-GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST HOST,$[HOST],PORT,$[PORT] Layer Names: 

Layer Names does not appear in the readers`s parameter, the translation runs without errors. However, I prefer the first approach. 

Thank you very much!

 

ben

[1] 

http://docs.safe.com/fme/2014/html/FME_GuiType/doc_pages/dynamic_multi_select_commas.txt


3 replies

Userlevel 4
Badge +13

Tough question.  If I were to truly debug this, what I'd need to do is examine the .fme file exported from a workspace that has your reader. (Or edit the workspace in a text editor and skip past all the # comments/XML stuff at the top end).  Then I could see what was being written into the FME mapping file code.

The dev team did chime in with this:

 

 

Given:
GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST HOST,$[HOST],PORT,$[PORT] Layer Names:

The question here would be if the HOST is the dataset?

If so:

GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST $[HOST],PORT,$[PORT] Layer Names:

If not:

GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST $[DATASET],HOST,$[HOST],PORT,$[PORT] Layer Names:

cf. http://docs.safe.com/fme/2014/html/FME_GuiType/doc_pages/feature_types.txt (which is similar to DYNAMIC_[SINGLE|MULTI]_SELECT GUI types but documented better)

That helps with the Dataset vs. a text parameter.

But I'm thinking somehow the actual parsing error you're getting is due to your DEFAULT_MACRO interaction with DEFAULT_VALUE -- and the interaction between metafiles and the mapping files they turn into.  I'd try getting rid of DEFAULT_MACRO in your metafile and just sticking with DEFAULT_VALUE and see if that helps.

Badge

Thanks for your answer.

 

 

I removed all DEFAULT_MACRO lines in my metafile, but it does not change anything.

 

 

I created two FME examples, both fmw files are attached:

 

1) noerror.fmw -> result if I write in my metafile:

 

-GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST HOST,$[HOST],PORT,$[PORT],LOGIN_REQUIRED,$[LOGIN_REQUIRED],USERNAME,$[USERNAME],PASSWORD,$[PASSWORD] Layer Names:

 

 

2) undefinedmacro.fmw -> result if I write in my metafile:

GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS LAYERLIST HOST,$[HOST],PORT,$[PORT],LOGIN_REQUIRED,$[LOGIN_REQUIRED],USERNAME,$[USERNAME],PASSWORD,$[PASSWORD] Layer Names:

 

 

The first one works, the second does not. Even without my reader installed, undefinedmacro.fmw causes the "Undefined macro `HOST_MYREADER_1' dereferenced in file..." error (tested with the FME Quick Translator).

 

 

I compared both files and...well if I comment out the "GUI OPTIONAL DYNAMIC_MULTI_SELECT_COMMAS" line (line 46) in undefinedmacro.fmw, it works again.

P.S.: Host is not used as DATASET, but even if I change that, the error occurs.

Badge

A little push ;-)

Reply