Skip to main content

Folks, first post and rank newbie. I've been using Mapinfo for 25 years and MSSQL for 15 so the basic GIS and query stuff I know well. First time user of FME.

I've had a live chat today and the SAFE guys were super helpful but it's clear my lack of understanding of the FME nomenclature has prevented a better outcome.

Hopefully I can explain here what I'm after.

I have some Mapinfo tables and want to create a GML.

That's the easy part. The hard part is that I have a single Mapinfo ID column that could have two different formats. One integer, one alphanumeric. The column is type char.

Depending on the value, the ID could be written to a GML tag, techID OR name.

My understanding is I use an AttributeManager (I could be wrong) and that I can somehow create a condition that will produce different results.

However all the examples I've looked at seem to evaluate the input value, modify the value and insert the modified value into the target field.

There doesn't seem to have a flow where I can redirect the output to a different field based on the condition and simply pass on the right format value to the right column.

I had considered two AttributeManagers one for one format going to one target and one for the other but this seems like an unweildy approach and doesn't account for exception(s). Unless you apply the exception rule to both AttributeManagers, again seems like a lot of work. (And perhaps I'm overthinking it)

Any advice appreciated.

The way to do this is using the AttributeManager (you were right).

Create new output attribute A using a conditional value (example: If ID between 0 - 100000) then output value to attribute A else leave blank.

Create new output attribute B using a conditional value (example: If ID begins with "A") then output value to attribute B else leave blank.

Conditional values can be found in the mouse menu for setting the values.

You can fill in the examples.

Hope this helps.


Hi @andyew, basically the same as @erik_jan's answer, but I would try conditional value setting with the "Type is" operator.

  • techID = If ID Type is Integer Then ID Else <No Action>
  • name = If ID Type is Integer Then <No Action> Else ID
Alternatively, you can create an attribute whose name will be determined by the condition and assign the ID to the new attribute, if you use the AttributeCreator.New Attribute = If ID Type is Integer Then "techID" Else "name"

Be aware that the new attribute name won't be exposed automatically in this AttributeCreator use. You can expose "techID" and "name" with the AttributeExposer if necessaly.

Hi @andyew, basically the same as @erik_jan's answer, but I would try conditional value setting with the "Type is" operator.

  • techID = If ID Type is Integer Then ID Else <No Action>
  • name = If ID Type is Integer Then <No Action> Else ID
Alternatively, you can create an attribute whose name will be determined by the condition and assign the ID to the new attribute, if you use the AttributeCreator.New Attribute = If ID Type is Integer Then "techID" Else "name"

Be aware that the new attribute name won't be exposed automatically in this AttributeCreator use. You can expose "techID" and "name" with the AttributeExposer if necessaly.
Another thought, if you are using FME 2017, conditional value setting might be available in the writer feature type - User Attributes tab, like this.

 


Thank you gentlemen. I'm getting further but it seems I still lack the ability to join your clearly written words with elements in FME. However after an hour of fiddling around I did end up with a desirable result.


Reply