Options

Dynamically accessing the corresponding variables

ShubhaShubha Member Posts: 139 Maven
edited November 2018 in Help
Hi,

I have an exampleset,

A B C D Var_A Var_B Var_C Var_D
23 45 67 89 5 5 5 4
23 45 12 76 6 4 6 3
23 45 67 78 7 3 7 2
87 54 32 23 3 2 8 1

As you see there are four A, B, C, D variables and their corresponding Var_A, Var_B, Var_C, Var_D variables. Now, I need four other columns giving the differences. (say (A-Var_A)...). The result should be:

Diff_A Diff_B Diff_C Diff_D
18 40 62 85
17 41 6 73
16 42 60 76
84 52 24 22

I attach the datafile, data.txt. And the case could be, I will have A, B, C, D, E,F...... variables

[attachment deleted by admin]

Answers

  • Options
    TobiasMalbrechtTobiasMalbrecht Moderator, Employee, Member Posts: 295 RM Product Management
    Hi,

    you could use the [tt]AttributeConstruction[/tt] operator to calculate the differences. You could also combine this operator with a [tt]FeatureIterator[/tt] to automatically iterate over attributes and calculate the differences.

    Kind regards,
    Tobias
  • Options
    ShubhaShubha Member Posts: 139 Maven
    Thanks Tobias,

    I quick question... It seems that i should use two "FeatureIterator" operators (one for A, B, C, D) and the other for 'Var' variables. Am I correct?

    Thanks, Shubha
  • Options
    TobiasMalbrechtTobiasMalbrecht Moderator, Employee, Member Posts: 295 RM Product Management
    Hi Shubha,

    no, just use one [tt]FeatureIterator[/tt] and set the attribute regex accordingly. In the [tt]AttributeConstruction[/tt] use the loop macro and generate the difference expressions using that macro.

    Regards,
    Tobias
  • Options
    ShubhaShubha Member Posts: 139 Maven
    Thank you very much... It worked...

Sign In or Register to comment.