Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
GabrielOtet
Contributor III
Contributor III

Definition of variable containing another variable

Dear experts,

 

I'm targeting to define a variable and the definition contain another variable(s).

Theoretically, it should work, practically I get all the time 0 as the output value.

That's why I just copy and paste the definition into a field and the values were the one expected (the definition is correct then). Most probably I'm missing something about it but I don't know what.

The variables are:

vBefAft / vTransferService / v_Before

=if(vBefAft='Before' AND vTransferService='0', fractile({<dbName={'=right(dbName,4)= v_Before'}, Field1={'DL'}, Field2={'Yes'}>}Field3, 0.1)/1000,
if(vBefAft='Before' AND vTransferService='1', fractile({<dbName={'=right(dbName,4)= v_Before'}, Field1={'UL'}, Field2={'Yes'}>}Field3, 0.1)/1000,
if(vBefAft='Before' AND vTransferService='2', fractile({<dbName={'=right(dbName,4)= v_Before'}, Field1={'DL'}, Field2={'No'}>}Field3, 0.1)/1000,
if(vBefAft='Before' AND vTransferService='3', fractile({<dbName={'=right(dbName,4)=v_Before'}, Field1={'UL'}, Field2={'No'}>}Field3, 0.1)/1000,


if(vBefAft='After' AND vTransferService='0', fractile({<dbName={'=right(dbName,4)=v_After'}, Field1={'DL'}, Field2={'Yes'}>}Field3, 0.1)/1000,
if(vBefAft='After' AND vTransferService='1', fractile({<dbName={'=right(dbName,4)=v_After'}, Field1={'UL'}, Field2={'Yes'}>}Field3, 0.1)/1000,
if(vBefAft='After' AND vTransferService='2', fractile({<dbName={'=right(dbName,4)=v_After'}, Field1={'DL'}, Field2={'No'}>}Field3, 0.1)/1000,
if(vBefAft='After' AND vTransferService='3', fractile({<dbName={'=right(dbName,4)=v_After'}, Field1={'UL'}, Field2={'No'}>}Field3, 0.1)/1000))))))))

Labels (1)
1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

Usually, if a variable value is another variable you need to expand it with $()

eg vVar has value eCount, which has value Count(Something)

in order to get it all working  you need to use $(vVar)

 

You can also see how everything is expanded, when you edit expression in Expression Editor (click f sight on the right hand side)

Another way to see what's going on is to big expression into parts and test it separately.

 

Regards,
Sergey

View solution in original post

2 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Usually, if a variable value is another variable you need to expand it with $()

eg vVar has value eCount, which has value Count(Something)

in order to get it all working  you need to use $(vVar)

 

You can also see how everything is expanded, when you edit expression in Expression Editor (click f sight on the right hand side)

Another way to see what's going on is to big expression into parts and test it separately.

 

Regards,
Sergey
GabrielOtet
Contributor III
Contributor III
Author

Hi Sergey, 

Indeed, the missing $(vVar) was the issue. The formula itself was giving the right results but was misused into the calculation after.

Actually, it would not be but the variable was used further on into Set analysis and was not evaluated at all.

Thank you for your help.