Skip to main content

It seems to me like I'm looking for a transformer very similar to the ExpressionEvaluator with 'Evaluation Mode' = 'Overwrite existing Attributes', only without the numeric evaluation (that doesn't seemingly 'wrap' the expression in a arithmic editer).

 

I thought about posting an idea about this (e.g. create new transformer or add parameter 'evaluation mode' = (text|arithmetic) to ExpressionEvaluator), but just wanted to check if I'm maybe overlooking existing functionality.

 

Attached is a workspace that illustrates the numeric evaluation possibilities in the ExpressionEvaluator, and an example of how I would like to have the option for a 'text evaluation' possibility to e.g. add '_concat_@CurrentAttribute' to each attribute in the selected group.

 

 

The StringConcatenator will let you do this, you need to switch to the Advanced Editor to set it upCapture


@ebygomm​ I did not know about that option. Tnx :)


It's also possible to use the StringReplacer to do the same thing.

Use regex to match the beginning of the string, and replace the beginning(which has 0 length) with the value you wantCapture 


It's also possible to use the StringReplacer to do the same thing.

Use regex to match the beginning of the string, and replace the beginning(which has 0 length) with the value you wantCapture 

Check. I knew about that transformer, but I didn't think about using it for this setting.

Nevertheless it doesn't seem to handle the @CurrentAttribute very well within the Replacement Text, or e.g. @Evaluate(...) within the string, whereas the StringConcatenator does work with these

 

Addendum.

I guess this doesn't really work so well due to the regex evaluation mode. For example, the brackets in @Evaluate(...) would be interpreted as a group, and probably string/math functions wouldn't be evaluated because it is performing the string as a regex, and not an (evaluation) expression

 

 


Check. I knew about that transformer, but I didn't think about using it for this setting.

Nevertheless it doesn't seem to handle the @CurrentAttribute very well within the Replacement Text, or e.g. @Evaluate(...) within the string, whereas the StringConcatenator does work with these

 

Addendum.

I guess this doesn't really work so well due to the regex evaluation mode. For example, the brackets in @Evaluate(...) would be interpreted as a group, and probably string/math functions wouldn't be evaluated because it is performing the string as a regex, and not an (evaluation) expression

 

 

The @CurrentAttribute isn't required, as you are only replacing the matched element, any unmatching parts, i.e. the rest of the attribute, remain as is. The replacement text just needs to include the text you want to add.

 

If you want to do anything more complicated you need to match the attribute as a group instead e.g. where \\1 is effectively your current attribute as the regex matches everything

CaptureI think you're correct that it won't work with @Evaluate though.


Check. I knew about that transformer, but I didn't think about using it for this setting.

Nevertheless it doesn't seem to handle the @CurrentAttribute very well within the Replacement Text, or e.g. @Evaluate(...) within the string, whereas the StringConcatenator does work with these

 

Addendum.

I guess this doesn't really work so well due to the regex evaluation mode. For example, the brackets in @Evaluate(...) would be interpreted as a group, and probably string/math functions wouldn't be evaluated because it is performing the string as a regex, and not an (evaluation) expression

 

 

Hi @ebygomm​ I know about the Regex options, and I have used this transformer before on multiple attributes.

My question for this topic was quite generic, where I would like to use evaluations using e.g. CurrentAttribute. That didn't work, and also e.g. @Evalutate(\\1*2) would work. This is no issue, since it does work for the StringConcatenator transfomer.

 

Thus, I already have my answer;

Arithmic evaluations on groups of attributes -> ExpressionEvaluator

Text (and/or arithmic) evaluations on groups of attributes -> StringConcatenator

Regex evaluations on groups of attributes -> StringReplacer


Reply