Question

Attribute Exploder not reading blank attributes

  • 28 September 2016
  • 18 replies
  • 16 views

Badge

Hi,

I have a set of MapInfo files and I'm using Attribute Exploder to get all the attributes. I noticed that the transformer doesn't give me the attribute if the value of the attribute is blank. I'm using FME 13. I can't find the information but I remember reading somewhere that FME13 has a bug for reading blank/null/empty attributes - is that the case?

How can I solve the issue?

Thanks!


18 replies

Userlevel 3
Badge +17

Hi @judychang, if "blank" means a "missing" attribute (in other words, the attribute does not exist), the AttributeExploder will not extract it even though the attribute name is displayed on Workbench user interface. It's natural. However, if "blank" means the empty string (it's a value and the attribute exists), the transformer should extract that.

Check if the attribute exists with the Logger or Data Inspector (Feature Information).

Badge +16

Hi @judychang , you could map the 'blank/missing/empty' attribute to a NoData (-9999) value before exposing it.

Badge

Hi @judychang, if "blank" means a "missing" attribute (in other words, the attribute does not exist), the AttributeExploder will not extract it even though the attribute name is displayed on Workbench user interface. It's natural. However, if "blank" means the empty string (it's a value and the attribute exists), the transformer should extract that.

Check if the attribute exists with the Logger or Data Inspector (Feature Information).

Hi @takashi, the attributes exist. They are just blank.

 

Like the attached picture, it would only explode lat and long but not the others.

 

missing-attribute.png
Badge

Hi @judychang , you could map the 'blank/missing/empty' attribute to a NoData (-9999) value before exposing it.

Yeah currently I am trying a "NullAttributeReplacer" before the exploder but for my datasets this method is a little inefficient so I'm looking to see if there's another way.
Userlevel 3
Badge +17
Hi @takashi, the attributes exist. They are just blank.

 

Like the attached picture, it would only explode lat and long but not the others.

 

missing-attribute.png
With the Table View in FME 2013 Data Inspector, you cannot determine whether the attribute exists. Select a feature and see the Feature Information window, like this.

 

Badge

Hi @judychang, if "blank" means a "missing" attribute (in other words, the attribute does not exist), the AttributeExploder will not extract it even though the attribute name is displayed on Workbench user interface. It's natural. However, if "blank" means the empty string (it's a value and the attribute exists), the transformer should extract that.

Check if the attribute exists with the Logger or Data Inspector (Feature Information).

Ah I see thanks. So it's the nature of my input file that causes this issue? Can I change "non-existent" to "empty"?
Userlevel 3
Badge +17
Ah I see thanks. So it's the nature of my input file that causes this issue? Can I change "non-existent" to "empty"?
I don't think there is a specialized transformer to do that in FME 2013, but you can use the AttributeRenamer.

 

Set the attribute names to both the Old Attribute column and the New Attribute column and leave blank (empty string) the Default Value column. For example, with this setting, the transformer assign empty string to the "missing" attribute only if it was actually missing. If "missing" attribute exists already, it does nothing. It's an odd way but may work as expected.

 

The NullAttributeMapper which has been introduced in FME 2014 can do that elegantly. I would recommend you to upgrade FME if possible.

 

Userlevel 3
Badge +17
Ah I see thanks. So it's the nature of my input file that causes this issue? Can I change "non-existent" to "empty"?
It seems that the MapInfo reader always treats blank attributes as missing. I don't know if it's an intentional behavior, but it's the same in other versions, e.g. FME 2016.

 

Badge

Hi @judychang, if "blank" means a "missing" attribute (in other words, the attribute does not exist), the AttributeExploder will not extract it even though the attribute name is displayed on Workbench user interface. It's natural. However, if "blank" means the empty string (it's a value and the attribute exists), the transformer should extract that.

Check if the attribute exists with the Logger or Data Inspector (Feature Information).

Yes I'm using NullAttributeReplacer. I guess there's no faster way. Would this be a suggestion for FME to take MapInfo empty string as empty instead of missing?

 

 

Userlevel 3
Badge +17
Yes I'm using NullAttributeReplacer. I guess there's no faster way. Would this be a suggestion for FME to take MapInfo empty string as empty instead of missing?

 

 

Looks like there is no way to set the MapInfo reader so that it reads blank attributes as empty string, unfortunately. It may be worth to try the PythonCaller, although it's not guaranteed to be definitely faster.

 

btw, why do you have to assign empty string to the missing attributes? Many transformers can treat a missing attribute as empty string. Depending on the following processes, it may not be necessary to do that.

 

Badge
Looks like there is no way to set the MapInfo reader so that it reads blank attributes as empty string, unfortunately. It may be worth to try the PythonCaller, although it's not guaranteed to be definitely faster.

 

btw, why do you have to assign empty string to the missing attributes? Many transformers can treat a missing attribute as empty string. Depending on the following processes, it may not be necessary to do that.

 

I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

Userlevel 3
Badge +17
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

Did try the AttributeRenamer?

 

Userlevel 3
Badge +17
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

ah, I've misread your comment. FME cannot recognize the name of missing attribute unless you specify it when creating the workspace.

 

But why do you need to assign "blank" (empty string) to missing attributes?
Badge
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

How can I specify when I create the workspace? to it recognises the name of missing attributes?

 

 

Userlevel 3
Badge +17
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

I elaborate a little more. FME Engine cannot recognize any missing attribute since features don't have both their names and values while the workspace is running, but FME Workbench can retrieve their names if they are defined in the source feature type (MapInfo data file in this case) as its schema. Therefore, attribute names defined in the source schema are exposed on the reader feature type and you can select them when setting parameters of a transformer.

 

Then, in many cases, FME can treats a missing attribute as the empty string if its name is specified through a transformer parameter. So, I thought it may not be necessary to consider assigning empty string to the missing attributes, depending on the following processes.

 

My question is: Why do you need to assign empty string to the missing attributes?

 

Userlevel 3
Badge +17
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

> How can I specify when I create the workspace?

 

Through parameters of a transformer. The concrete way depends on what you want to do. For example, if you want to assign a value to a missing attribute, it's equivalent to create a new attribute, so you can specify its name in the "Attribute Name" column of the AttributeCreator.

 

Badge
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

I'm trying to compare the attributes of some Mapinfo files with a spec. So I am extracting all the attribute names of the Mapinfo files. I use AttributeExploder but if the attributes in the Mapinfo files don't have any values in then the transformer doesn't give me those attributes. I have to assign those attributes a blank first - kind of defeats the purpose of my check.. so I'm wondering if there's a better method to get all the attributes? Sorry if I didn't explain properly earlier.

 

 

Userlevel 3
Badge +17
I am assigning a "blank" value to those missing attributes. But I'm looking for a way to not have to pick each and every attribute individually. I'd like something like - if attribute if missing, assign "blank". Does that make sense?

 

 

If the purpose is to check the schema defined in the MapInfo files, it might be better to use the Schema (Any Format) reader. The Schema reader reads the schema definition for each feature type and then outputs schema feature having a structured list consisting of "attribute{}.name", and "attribute{}.native_data_type" etc., which stores attribute names and data types defined in the source feature type.

 

Reply