Skip to main content

Hi all,

the following use case - please see the screen-shot:

Is there any way from code side (C++ custom plugin) to determine that "CUSTOM1" shall be exposed (checked by user) but "CUSTOM2" shall NOT (unchecked by user).

In the mapping file, DEF line I still see "CUSTOM2" is present.

But from another site if I open saved .fmw file - FME WB knows which attributes are unchecked/checked.

So FME WB is aware of that - any way to make my custom plugin (Reader) to be aware as well?

Thanks!

Hi @egorbaykovnn,

I dont know if that you want is possible in FME Workbench.

By the way has a link about Creating a Custom Format.

Thanks,

Danilo


Hi @egorbaykovnn

 

 

I will update this comment once I get into the office tomorrow morning about how to verify if the attribute has been exposed or not. I suspect that you will want to look directly at the reader. If you can take a look at these examples/documentation from the Plugin builder help it may assist or get you started.

 

 

<fmeinstall>\\pluginbuilder\\samples\\cpp\\code\\FMEReaderWriter\\myformatfsmc\\myformatfsmcreader.cpp

 

 

I hope this helps you get started.

i would be interested as well.

Was trying to find where this hidden flag for dynamically created attribute resides.

Hidden attributes are in the FME_Attributenames, but reading and resetting does not change their shyness to exposure.


Hi @egorbaykovnn

 

 

I will update this comment once I get into the office tomorrow morning about how to verify if the attribute has been exposed or not. I suspect that you will want to look directly at the reader. If you can take a look at these examples/documentation from the Plugin builder help it may assist or get you started.

 

 

<fmeinstall>\\pluginbuilder\\samples\\cpp\\code\\FMEReaderWriter\\myformatfsmc\\myformatfsmcreader.cpp

 

 

I hope this helps you get started.
Thanks for the info @trentatsafe !

 

I checked myformatfsmcreader.cpp from FME examples but didn't find any clue how to get exposed attr info.

 

Per my understanding the attr details are retrieved on "virtual FME_Status readSchema(IFMEFeature& feature, FME_Boolean& endOfSchema);" i.e. before the user is able to change exposed checkbox value.

 

And during translation when "virtual FME_Status read(IFMEFeature& feature, FME_Boolean& endOfFile);" is called there is also no exposed info.

 

Plus there is the following topic "https://knowledge.safe.com/questions/41730/remove-attributes-on-read.html" and people saying there that FME is reading all the attributes no matter if they are exposed or not.

 

 

So could it be the case that Exposed attr info is not provided to Reader at all?

 

 

Thanks!

 


Hello @egorbaykovnn

I apologize for the delay in response.

In order to determine if a User attribute is exposed or not based on the feature type dialogue(shown in the picture you attached). The following has to be done:

 

 

1. add `FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE` to the mapping file.

 

2. When you parse the def lines, if 'fme_attribute_reading all' is found on the def line, they read all the attributes, not just the ones listed.

 

3. If they see "fme_attribute_reading defined", they read the ones listed.

 

 

The documentation referencing this can be found here: https://docs.safe.com/fme/html/FME_Metafiles/index.html

 

This will be all that is required for a new custom plugin format. If behavior for existing workspaces needs to be adhered to, there are some more steps. Please let me know if you require further guidance.


Hello @egorbaykovnn

I apologize for the delay in response.

In order to determine if a User attribute is exposed or not based on the feature type dialogue(shown in the picture you attached). The following has to be done:

 

 

1. add `FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE` to the mapping file.

 

2. When you parse the def lines, if 'fme_attribute_reading all' is found on the def line, they read all the attributes, not just the ones listed.

 

3. If they see "fme_attribute_reading defined", they read the ones listed.

 

 

The documentation referencing this can be found here: https://docs.safe.com/fme/html/FME_Metafiles/index.html

 

This will be all that is required for a new custom plugin format. If behavior for existing workspaces needs to be adhered to, there are some more steps. Please let me know if you require further guidance.

Thanks for the info @trentatsafe!

 

Will check this shortly.

 

Just one note for now - I guess the line in metafile shall be "FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE". I.e. DEFLINE instead of DEFINE.

 

Correct?

 

Thanks!

 

 


Thanks for the info @trentatsafe!

 

Will check this shortly.

 

Just one note for now - I guess the line in metafile shall be "FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE". I.e. DEFLINE instead of DEFINE.

 

Correct?

 

Thanks!

 

 

Hi @egorbaykovnn

 

That is correct, thank you for spotting the typo. I have fixed it.
Hi @egorbaykovnn

 

That is correct, thank you for spotting the typo. I have fixed it.
Hi @trentatsafe,

 

this "FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE_ATTRS" works fine.

 

Except for one case: no matter if user choose "All Attributes" or "Exposed Attributes" check box in "Attributes to read" group - the resulted metafile always has "<PLUGIN_NAME>_ATTRIBUTE_READING DEFLINE_ATTRS" (i.e. DEFLINE_ATTRS value is always set for some reason).

 

The difference between "All Attributes" and "Exposed Attributes" is in _DEF line content.

 

For "All Attributes" _DEF line doesn't have any attributes info.

 

For "Exposed Attributes" _DEL line has the attributes selected by user.

 

I hope it is expected behavior unless I did something wrong on my site.

 

I just added "FORMAT_PARAMETER ATTRIBUTE_READING DEFLINE_ATTRS" line to the add of my metafile (.fmf)

 

Thanks!

 


Reply