Solved

How to formulate the names of existing attributes using values from another attribute?

  • 22 August 2017
  • 5 replies
  • 0 views

Userlevel 4
Badge +13

In this scenario, the source data has some attributes with names following a common pattern. e.g. test (a), test (b), test (c), etc.

 

We want to use all of these attributes on the left side of some test clause (in TestFilter). Instead of manually selecting every attribute, is it possible to use a formula to represent test (a), test (b), test (c)? We do have an attribute "name", whose values are a, b, c, etc. Also, the right side of the test clause can be set with the same expression, for all of these attributes.

Any suggestions would be much appreciated!

icon

Best answer by xiaomengatsafe 22 August 2017, 20:09

View original

5 replies

Badge +8

HI could you provide us with a real sample of data? 10 records would do. Thank you @FMELizard

Userlevel 1
Badge +21

If you want to test multiple attributes for the same expression, using an AttributeValidator may be the best way of performing the test

Badge +2

HI could you provide us with a real sample of data? 10 records would do. Thank you @FMELizard

I don't actually have the real data. I'll mock something up.

 

 

Badge

Hi @FMELizard :)

please take a look at the attached workspace: it won't eliminate 'selecting each attribute' completely, but will help avoiding retyping the same condition/expression again and again.

There are two scenarios in the workspace:

  • _a > 10 AND _b > 10 AND _c > 10 AND _d > 10 AND _e > 10

and

  • _a > 10 OR _b > 10 OR _c > 10 OR _d > 10 OR _e > 10

We might be able to construct more complex conditions.

Badge +2

After some testing, I realized there is a GUI bug in play that caused some confusion. We can easily use Text Editor to formulate the attribute names as such: @Value(test (@Value(name)))

And using it on the Left Value of a test Clauses works. However the Test Conditions GUI shows this as invalid (red). But the workspace runs fine, and produces expected result. I'll report this as a bug, with our developers.

 

Attached is a sample workspace to demonstrate what was the scenario, and how the testFilter was set up to get the result. formulate-attributename-with-values.fmw

Reply