Skip to main content

Hello Forum,

 

I have an attribute in a gpkg dataset containing year values (e.g.: 2016). Where a year is unknown the value is <null>.

 

When this dataset is translated into tab or geojson any values of <null> get shown as -9999. I assume that's how the MapInfo tab translator sees <null> values. But instead of -9999 this I want any <null> value to be blank.

 

With StringReplacer I know I can replace a value such as 2016 with 3016, not that I would want to do that!. But when I type in <null> as the 'Text to replace' and leave 'Replacement text' blank, the output still shows -9999 instead of it being blank.

 

I wonder if there is a special way of specifying <null>. How do I effectively replace <null> value in an integer attribute with blank?

 

I've seen https://community.safe.com/transformers-9/replace-value-with-a-null-1778 but that doesn’t quite cover it.

 

Thanks,

Stuart

If the output is shown as -9999 it means that it is at that moment an integer and not really Null anymore. If you want to use the StringReplacer you can replace -9999 with nothing and then connect it to an NullAttributeMapper with the following settings:
 

This makes it very clear what you are doing and which you can elaborate on even more with an annotation.

 

Another option is to use an AttributeManager with for example a conditional statement:
 

Normally one line in there would be enough. I put those two as an example. You can play around with your exact dataset to see what works for you.


Thanks for that, @matthieuv . I’ll look into those options.


HI @matthieuv . I tried option one. I have Creator> featureReader>AttributeManager>StringReplacer>NullAttributeManager>FeatureWriter.

 

The StringReplacer and NullAttributeManager are set up like below, but I’m still seeing the value -9999 in the output tab file.

 

 


@scarter if you click on a row in the right screenshot what is the exact information you see in the Data Information Window for the attribute Construction_year_where_known? If you have FME Form 2024 it will also show the data type besides Property and Value.

 

 


@matthieuv . The right side screenshot is from MapInfo.


As @david_r has answered previously.  Mapinfo TAB does not support NULL values in numeric fields and so FME will by default write -9999 in its place.

Separately, don’t need the StringReplacer, can do all substitutions within the one NullAttributeMapper by using the “Or Attribute Value Is” setting.  In here, can define your own “Null” Value to substitute say -1, instead of letting the TAB Writer change Nulls to -9999.
 

 


What do you see if you select a feature when inspecting the result from the FeatureWriter?


@matthieuv I get this in Inspector. Where the years is null/-9999/empty the values shown is <null> .

 


I think I might have misunderstood your question. 

After you read the gpkg add a AttributeManager with a conditional value for your attribute. Replace the yellow attribute with your own.
So if it is Null it will replace it with a value. Leave that value completly empty and then see what the output will be to Mapinfo.

 


@matthieuv Thanks for that. I’ll give it a go. Thanks for all your help on this. I don’t want to use up any more of your time. So, if still not working after that I’ll raise a case through Support. Fingers crossed it works.


Reply