Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load variable from outside

I load  many variables  from .xls  into QVW . But I can't load the following :

   sum({<year={"$(=left(saledate,4)-1)"}>} sales)

after loading , it became :   sum({<year={''}>} sales)

if I set it in QVW ,it is ok , How to do it  ?

9 Replies
swuehl
MVP
MVP

How do you load your variables from .xls? How does your current script look like?

Not applicable
Author

it is like the following :

VariablesTable:
LOAD VariableName,
     VariableValue
FROM
[QVDStore\VariablesTable.QVD]
(qvd); or xls
//* Set Equation variables
//* The following loop allowing for loading numerous variables dynamically,
//* without having to call them by name.
for i=0 to noofrows('VariablesTable')-1
  LET var_name= peek('VariableName',i,'VariablesTable');
  LET $(var_name) = peek('VariableValue',i,'VariablesTable');
  TRACE Load Variable: $(var_name) = $($(var_name));
next i

all variables seem ok . but for like this kind of  '=..' is not ok .

MK_QSL
MVP
MVP

Let vNumberOfRows = NoOfRows('VariablesTable');

For i = 0 to (vNumberOfRows - 1)

     Let vVariable_Name = Peek('VariableName',i,'VariableTable');

     Let [$(vVariable_Name)] = Peek('VariableValue',I,'VariableTable');

Next

Not applicable
Author

my script is : for i=0 to noofrows('VariablesTable')-1   LET var_name= peek('VariableName',i,'VariablesTable');   LET $(var_name) = peek('VariableValue',i,'VariablesTable'); //  TRACE Load Variable:   let $(var_name) =' $($(var_name))'; next i I thinks the problem is '=' in variables ,It seem calcault it before .

MK_QSL
MVP
MVP

How you have stored Varaible Expression / Values in Excel File?

You have to store like

SUM(Value)

Not like

=SUM(Value)

MK_QSL
MVP
MVP

Consider that your expression is something like below...

only(  {$<Year={"$(=max(Year))"}>} Year)

If you Trace this expression during Reload $(=Max(Year)) will be shown as blank as during loading no Year is selected.

May be I am not able to explain the exact technical information....

Not applicable
Author

  let $(var_name) =' $($(var_name))---- this is wrong for your kind of expresion, I must use   :TRACE Load Variable: $(var_name) = $($(var_name));  it is ok now . I can't explan it also. thanks your help ;

swuehl
MVP
MVP

Yes, I also think it's just a problem with your TRACE statement, where the dollar sign expansion in your expression you  evaluate in your variable won't work.

So you should have got the correct variables build right from the start, when looking in the variable overview after load, right?

Not applicable
Author

YES ,IT is OK now  use trace load .