Skip to main content

Hi Team,

I have a simple example attached and it contain just a Reader and i would like to generate another shapefile.

The problem is: the Writer ( using the transformer FeatureWriter ) needs contain one Attribute:

@Value(De_Produto)

I tested to get the value from the source attribute De_Produto configurating the Writer, but without success:

How can i get the value attribute and transform the value this attribute as Attribute Name my Writer?

Thanks in Advance,

Danilo

Danilo,

From the screenshot it looks like you have the Writer in Dynamic mode.

If you switch to Manual you can add the attribute.


Hi @erik_jan, thanks your reply.

I changed the mode Writer to Manual and used the transformer SubstringExtractor to clean up the value, because has space and special caracter.

When i execute without transformer FeatureWriter the result is OK ( image OK.png ). But the results is not good when i generate the shapefile output ( image agora.png ).

Thanks


Have a look at the AttributeDereferencer transformer.

I believe that is what you need.


Have a look at the AttributeDereferencer transformer.

I believe that is what you need.

Hi @erik_jan,

 

 

The log error when i open the shapefile in FME Data Inspector:

 

The 'FFS' reader was destroyed successfully

Failed to display the table contents due to the following error:

----------------------------------------------------------------

Feature specification `saida_De @Value(De) %0:<missing_232f> De_Produto %1:<missing_232f> Qtde_Produ %2:<missing_232f> De %3:<missing_232f>' in mapping file row `FFS saida_De @Value(De) %0:<missing_232f> De_Produto %1:<missing_232f> Qtde_Produ %2:<missing_232f> De %3:<missing_232f>' is not valid -- it has an invalid number of entries

Program Terminating




Translation FAILED.

----------------------------------------------------------------




Hi @erik_jan,

 

 

The log error when i open the shapefile in FME Data Inspector:

 

The 'FFS' reader was destroyed successfully

Failed to display the table contents due to the following error:

----------------------------------------------------------------

Feature specification `saida_De @Value(De) %0:<missing_232f> De_Produto %1:<missing_232f> Qtde_Produ %2:<missing_232f> De %3:<missing_232f>' in mapping file row `FFS saida_De @Value(De) %0:<missing_232f> De_Produto %1:<missing_232f> Qtde_Produ %2:<missing_232f> De %3:<missing_232f>' is not valid -- it has an invalid number of entries

Program Terminating




Translation FAILED.

----------------------------------------------------------------



Hmm, I played around with it and do not get it to work either.

 

Hope somebody else has a solution.

 

 


Hi danilo_inovacao

The solution for this is using 'SchemaSetter'.

This will return the output as you expected as depicted in the image.

You need to add a 'SchemaSetter' transformer just before the 'FeatureWriter' and set the 'Schema Sources:' to "Schema From Schema Feature" under 'Dynamic Properties' in the 'FeatureWriter'.

'SchemaSetter' add the new attribute you created using a value of another attribute to the schema of the feature.

Instructing 'FeatureWriter' (this can be done in any 'Writer' as well) to use Schema Feature as the source of schema allows it to pass the correct schema set by 'SchemaSetter' into the output.

Please see the attached workspace for more information.

workspace-value-attribute.fmwt

danilo_inovacao

 


Hi @danilo_inovacao, I don't think you can define an attribute name for a destination feature type using an attribute value contained by a feature to be written.
FME seems to configure the schema of a destination feature type before the first feature is written, so I think that FME has no chance to refer any feature attribute value while configuring a destination schema.


Hmm, I played around with it and do not get it to work either.

 

Hope somebody else has a solution.

 

 

 

Hi @erik_jan, thanks 🙂

Hi danilo_inovacao

The solution for this is using 'SchemaSetter'.

This will return the output as you expected as depicted in the image.

You need to add a 'SchemaSetter' transformer just before the 'FeatureWriter' and set the 'Schema Sources:' to "Schema From Schema Feature" under 'Dynamic Properties' in the 'FeatureWriter'.

'SchemaSetter' add the new attribute you created using a value of another attribute to the schema of the feature.

Instructing 'FeatureWriter' (this can be done in any 'Writer' as well) to use Schema Feature as the source of schema allows it to pass the correct schema set by 'SchemaSetter' into the output.

Please see the attached workspace for more information.

workspace-value-attribute.fmwt

danilo_inovacao

 

Hi @pallegama, thanks your help and Workspace template. This Custom transformer is very powerful :)

 

So i have a question: If i would like to have just this attribute FERTILIZ in my shapefile writer, how can i get it?

 

 

Thanks one more time.

 

Danilo

Hi @danilo_inovacao, I don't think you can define an attribute name for a destination feature type using an attribute value contained by a feature to be written.
FME seems to configure the schema of a destination feature type before the first feature is written, so I think that FME has no chance to refer any feature attribute value while configuring a destination schema.

Hi @takashi, thanks your information. And i tried with the custom transformer SchemaSetter mencioned by @pallegama, and my writer was generated with all attribute values from my source data too.

 

And this action to define an attribute name for a destionation using an attribute value i believe that can be create in future versions :)

 

 

Thanks,
Hi @pallegama, thanks your help and Workspace template. This Custom transformer is very powerful :)

 

So i have a question: If i would like to have just this attribute FERTILIZ in my shapefile writer, how can i get it?

 

 

Thanks one more time.

 

Danilo
Hi @danilo_inovacao,

 

Sorry for the delay to respond your question. You might have figured out this yourself by now. However, as depicted in the attached workspace template, you can use an AttributeKeeper at the beginning to retain the required attributes only (deselection of attributes at Reader just hide them without actually discarding them from the process).

 

Then the SchemaSetter can be used to remove all other attributes you do not required.

 

Please make sure to remove any attributes in the writer as well.

 

Regards, Priyantha Pallegama

 

workspace-value-attribute.fmwt

 


Reply