Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have a table where the the columns are actual and budget figures, where the names of the budget columns are that of the actuals but with the prefix 'B'. I try to create a variable based on that of another but I can't reference the contents correctly. This example should show the problem where the value of 'BValue' is 'BColA' rather than 101,124,121,105 I am trying to achieve:
test1:
LOAD * INLINE [
ColA, ColB, ColC, BColA, BColB, BColC
12, 15, 18, 101, 108, 114
25, 20, 17, 124, 122, 106
1, 29, 5, 121, 120, 117
6, 7, 11, 105, 108, 107
];
set vCol = 'ColA';
set vBCol = 'B' & '$(vCol)';
test2:
load recno() as recno,
$(vCol) as value,
$(vBCol) as BValue
resident test1;
Any thoughts?
Regards,
Gordon
I believe you should use let instead of set for it to work.
let vCol = 'ColA';
let vBCol = 'B' & '$(vCol)';
I believe you should use let instead of set for it to work.
let vCol = 'ColA';
let vBCol = 'B' & '$(vCol)';
Actually, Set is what we typically use for storing expressions that will be evaluated later...
I'm puzzled - in my mind, your syntax should work... I got the expected result with the following:
set vCol = 'ColA';
set vBCol = B$(vCol);
I also got the expected result using LET:
let vCol = 'ColA';
let vBCol = 'B' & '$(vCol)';
I still can't explain why this one works, and the other one doesn't...
Oleg
Thanks Daniel and Oleg,
The solution is in using LET instead of SET. LET evaluates so technically the statements should be:
set vCol = 'ColA';
let vBCol = 'B' & '$(vCol)';
Regards,
Gordon