Skip to main content
Solved

How to assign attribute values based on CAD layer name?


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!

 

 

View original
Did this help you find an answer to your question?

3 replies

jovitaatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • 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
  • March 20, 2020
jovitaatsafe wrote:

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+33
  • Influencer
  • 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+

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings