Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nesting Variables with parameters

I'm trying to pass the results of a variable with parameters to another variable having parameters but I can't quite get it to work.  I have this 2 variables which work when they are not nested.

eNetScenMV = Sum ({$<$(vMonthEnd), [Account Type]=, [Scenario]={$1}>} [#Market Value Usd])

     usage: $( eNetScenMV("PC1-") )

eSumOfSquares = sqrt( sqr($1) + sqr($2) + sqr($3) )

     usage $( eSumOfSquares(1, 2, 3) )

I need to use the results of eNetScenMV as parameters to eSumOfSquares like so in a TEXT object:

=$(eSumOfSquares($(eNetScenMV("PC1-")), $(eNetScenMV("PC2-")), $(eNetScenMV("PC3+"))))

When I do this I get an "Error in Set Modifier Expression".  I've tried a number of things but cannot get it to work.  I appreciate any help on this.

1 Solution

Accepted Solutions
Not applicable
Author

Nasario,

please try:

$(eSumOfSquares($(=$(eNetScenMV("PC1-"))), $(=$(eNetScenMV("PC2-"))), $(=$(eNetScenMV("PC3+")))))

View solution in original post

9 Replies
Not applicable
Author

Nasario,

please try:

$(eSumOfSquares($(=$(eNetScenMV("PC1-"))), $(=$(eNetScenMV("PC2-"))), $(=$(eNetScenMV("PC3+")))))

Not applicable
Author

Thanks Dariusz Mielczarek this worked!  I'm still trying to understand this dollar expansion business .  Does the inner dollar expansion =$(eNetScenMV("PC1-") get the expression to be expanded by the outer $(...)?

Slawomir
Contributor
Contributor

Hello everybody,

I have a similar problem, but I couldn't solve it. Would you help me, please?

I have 2 SET-variables:

Set vTest1=left($1,$2);
Set vTest2=right($1,$2);

Test-Solution with variable #1:

Let X = $(vTest1('Hello you',7));
Trace '$(X)'; //the solution is 'Hello y'

Test-Solution with variable #2:
Let X = $(vTest2('$(X)',1));  // or Let X = $(vTest2('Hello you',1))
Trace '$(X)'; //the solution is 'y'

Now I nest the two variables together:

Let X = $(vTest2($(vTest1('Hallo you',7)),1));
Trace '$(X)'; // the solution is an error

I tried another way (similar to your solution):

Let X = $(vTest2($(=$(vTest1('Hallo you',7))),1));
Trace '$(X)'; // but, the solution is an error too

 

E_Røse
Creator II
Creator II

Slawomir, Did you find a solution to this?

marcus_sommer

Nesting of variables failed mostly because each included comma is treated as parameter-delimiter of the variable. Also the creating and calling syntax is depending on the specific context.

Even if it's possible to develop working solutions the nesting of variables could become quite complex - much more as it would be sensible within the most scenarios because the aim of variables is to simplify things and not to gain the opposite ... Therefore my suggestion - keep it simple.

E_Røse
Creator II
Creator II

@marcus_sommer 

Not using a nested variable is not option (this time).

The problem seems to be that I cannot avoid the inner variable being evaluated during the load (which does not work with the $1 placeholder in the inner parameter). It works if I create the definition in the UI (which I was hoping to avoid).  

I can create  this parameter  pTemplate_DimAColumn_Show in th UI $(pTemplate_DimAColumn_ShowCondition2($(=$(pTemplate_DimAColumn($1)))))  and it works as expected.

In the load on the other hand, the inner parameter just evaluates to missing value and I get the same result as just writing: $(pTemplate_DimAColumn_ShowCondition2($1)).

marcus_sommer

This kind of $-sign expansion: $(= ... ) isn't available within the script else it's UI only. This means you need either a different logic how the variables are designed and later used or you remain by the working solution by creating the variables within the UI (beside this I'm not so sure if it has really benefits to create UI variable within the script).

E_Røse
Creator II
Creator II

I do not really want to evaluate anything within the script.  I just want to create a string that I will evaluate later. 

Load scripts and charts/tables are fast to copy to another app. Variables in the UI are not. So in the end, I will add it to the table instead.

marcus_sommer

There are various ways to transfer variables between documents like macros, reading the meta-data, using prj-folders, ... I think there were even more which I don't remember yet and unfortunately a lot of older community-content to these topic isn't available anymore.

But you are right it's not so easy as copy & paste from script or objects ... but you may also copy & paste of applications and then removing any unwanted stuff.