Announcements
cancel
Showing results for
Did you mean:
Partner - Contributor II

## nested variables

Hi everybody,

it's my first post on this community.

I have defined 2 variables (var1,var2). The first variable is an expression of fields extracts from my LOAD and it works well. var1 = Sum([Field1])+Sum(Field2])

The second var is an expression of my first var (var1) and some fields extracts from my LOAD. In this case my expression returns null, because it looks like it not evaluate my first var. var2 = \$(var1) + sum([Field3])

How can i use a var in the expression of another var?

Best regards

1 Solution

Accepted Solutions
MVP

Try to remove this equal sign here

or if you want to use the equal sign, try to use your variable without a dollar sign expansion and see if that helps you resolve your issue.

6 Replies
Champion III

Try this may be:

SET vFlag  =  = Sum(Field1) + Sum(Field2);

SET vFinal =  = \$(vFlag) + Sum(Field3);

Partner - Contributor II
Author

I attach the image of my problem:

The column [expression] is made by this expression:

=(\$(Qtà 1 Lvl DiBa)*[Qtà 2° Livello])+(\$(Qtà 1 Lvl DiBa)*(if(isnull([Sfrido % Medio]),0,[Sfrido % Medio]))/100)

The column [variables] is made by this expression:

=\$(Qtà 2 Lvl DiBa)

In my sheet i have defined in "view variables..."

The expression of the column [expression] (marked green) is the same expression defined in the variable [Qtà 2 Lvl DiBa] set in the column [variables]

My question is: why the result of column [variables] is "-" (null) and in the result of column [expression] is correct?

I hope i have explained the situation.

MVP

Try to remove this equal sign here

or if you want to use the equal sign, try to use your variable without a dollar sign expansion and see if that helps you resolve your issue.

Champion III

Can you try using quotes around your variables and try? If not could you please upload this sample to work on it quickly?

Like: Can you try this

= ('\$(Qtà 1 Lvl DiBa)' * [Qtà 2° Livello])+ ( '\$(Qtà 1 Lvl DiBa)'  *  (if(isnull([Sfrido % Medio]),0,[Sfrido % Medio]))/100)

Master

Hi Francesco,

You could try RangeSum( \$(var1) , sum([Field3])) instead of ' + '. Rangesum treats a non numeric or a null argument as a zero rather than throwing an error like '+'. Maybe that will solve the problem.

Cheers

Andrew

Partner - Contributor II
Author

Thank to everyone for trying to help me.

The answer of Sunny solve my problem.

Best regards

Community Browser