Skip to main content

Hello,

I have text attributes of dimensions - such as 500/90 , 800/460, 30/90 etc. In a result I need to get the largest dimension value and delete the rest. For example - get the value 800 (and delete /460) or get 90 (and delete 30/ ).

Any ideas, how to manage this?

Here's one way to do it:

  1. AttributeSplitter on "/", this will create a list with alle the dimension values
  2. ListSorter "numeric descending" on the list
  3. ListIndexer to extract list item 0, which will contain the largest value
  4. AttributeRemover to remove the temporary list

Use regular expressions in a StringSearcher.

For the counter: \\d+(?=\\/)

For denominator: (?<=\\/)\\d+


I would use the ExpressionEvaluator with this expression after splitting the dimension into two parts with the AttributeSplitter.

@max(@Value(_list{0}),@Value(_list{1}))

I would use the ExpressionEvaluator with this expression after splitting the dimension into two parts with the AttributeSplitter.

@max(@Value(_list{0}),@Value(_list{1}))
If the list never contains more than two items, this is a great solution.

I would use the ExpressionEvaluator with this expression after splitting the dimension into two parts with the AttributeSplitter.

@max(@Value(_list{0}),@Value(_list{1}))
Yes, the solution can be applied only if the text contains just two parts.

 

Just an experiment. The TclCaller with this expression can be applied to any number of dimensions, also no need to AttributeSplitter.

 

expr max( regsub -all / pFME_GetAttribute text] ,])

 


I tried all three methods:

 

For me Mr. takashi`s suggested method works perfect as well as Mr.david_r`s method.

For this time I used Mr. takashi `s method, but I also made a transformation, using Mr.

david_r`s method for more complicated cases.

 

About jneujens method - maybe I do something wrong, but following by steps in Your comment, I`ve got one new column with a value before and other new column with value after the "/" but not the value of the largest one, so I must compare them.

Anyway - Thanks to all!


Reply