Skip to main content

I read an excel file. I extract the value of each cells and put it in my database via a writer. But sometimes, there is no value in the cell.

So I have another excel file to map each cell with a default value. But I cannot manage to actually map it.

Is there a transformer for doing it?

Or Do I have to extract the data from the second xls file into a dictionnary in my workspace to use it?

Thanks.

You could use an AttributeExploder to iterate over all the attribute names, then use a FeatureMerger to get each default value per attribute, then a NullAttributeMapper to substitute empty or missing attributes with the default.


Hi,

If the default value is null then use as @david_r suggested else if you want some default value when data is not present use AttributeCreator when If Attribute is Missing, Null, or Empty (see the link below for details)

http://docs.safe.com/fme/2016.1/html/FME_Desktop_D...


Another way to map cells from one to another sheet.

Expose xlxs_row_id.

Then explode the attributes. Remove excess attribute (regex fme* out of the set)

Columnname and row_id can be used to map the values.

Test for the empty cells.

Then use 2 feature mergers to merge them to the mappingcells.


Thanks all of you for your answer. Indeed there are a lot of ways to do the same thing.

A colleague of mine find an appropriate solution for my workspace.

First an AttributeExploder to obtain the cells value of the first xls file. Then a StringConcatenator to give a name/reference for each cell (with a value). Next a Joiner to match the cells reference into the mapping xls file. This file contain the default value.

Finally I just have to check if there is no value in the first cell and there is a default value. At last, an AttributeCreator to put the right value in the attribute.


Reply