Skip to main content
Solved

How to assign attribute values based on CAD layer name?

  • March 20, 2020
  • 3 replies
  • 221 views

Hello all,

I am a relatively new FME user. I am looking for advice on the most efficient way to assign attribute values based on CAD layer name.

Specifically I am working with several sewer main layers that all begin with the diameter of the mains contained within. The way I have built out my work space does achieve what I am looking to do, however as you can see by then screenshot, it is horribly inefficient. I am wondering if anyone has any advice on how to consolidate the process I built out in that ridiculous branching process? Any advice would be much appreciated.

Note: I understand this can likely be achieved in python very easily. I am not expert with such methods so if there is a way to achieve what I am looking to do using strictly transformers, that would be preferable to python solutions. That said, python solutions are also appreciated.

Thanks,

Nate

Best answer by jovitaatsafe

Hi @nking,

Thanks for posting your question! Have you explored the use of conditional values yet at all? We've got a good article here on Testing with If-Then Conditional Statements. It includes a workspace template that you can download and explore as well. The idea is to do everything in the attribute-managing transformer (such as the AttributeManager). You can access it in the Attribute Value dropdown > Conditional Value... .

 

 

In this way you can set up a single transformer to test expressions like IF Diameter = 4, set <attribute-name> to <value>, ELSE IF Diameter = 6 ... etc. It can be a lengthy set up but it all happens in one transformer rather than multiple repeated. Hope that gives you some ideas to work with!

 

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

jovitaatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • 635 replies
  • Best Answer
  • March 20, 2020

Hi @nking,

Thanks for posting your question! Have you explored the use of conditional values yet at all? We've got a good article here on Testing with If-Then Conditional Statements. It includes a workspace template that you can download and explore as well. The idea is to do everything in the attribute-managing transformer (such as the AttributeManager). You can access it in the Attribute Value dropdown > Conditional Value... .

 

 

In this way you can set up a single transformer to test expressions like IF Diameter = 4, set <attribute-name> to <value>, ELSE IF Diameter = 6 ... etc. It can be a lengthy set up but it all happens in one transformer rather than multiple repeated. Hope that gives you some ideas to work with!

 

 


  • Author
  • 5 replies
  • March 20, 2020

Hi @nking,

Thanks for posting your question! Have you explored the use of conditional values yet at all? We've got a good article here on Testing with If-Then Conditional Statements. It includes a workspace template that you can download and explore as well. The idea is to do everything in the attribute-managing transformer (such as the AttributeManager). You can access it in the Attribute Value dropdown > Conditional Value... .

 

 

In this way you can set up a single transformer to test expressions like IF Diameter = 4, set <attribute-name> to <value>, ELSE IF Diameter = 6 ... etc. It can be a lengthy set up but it all happens in one transformer rather than multiple repeated. Hope that gives you some ideas to work with!

 

 

@jovitaatsafe this is exactly what I was looking for. Thank you for the advice!


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • March 20, 2020

If your layer names all being with a number followed by something else, you can also probably use a string searcher with a regular expression to create the value

e.g. the following will match any number(s) at the beginning of a value

^\d+