Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to load a formula (or variable containing a formula) in a load*inline.
As a simple example I got:
load * inline [
Variable_name, sum
x, sum({<ProdType={'PS-E'}>}ActQuantity)
y, 100
]
When I make a table box (or a graph) it does not return me the actual value for the sum just the text.
Any suggestions?
//Test Load for expression values
test1:
Load * inline [
ProdType, ActQuantity
PS-E, 100
PS-E, 100
];
// Varaible Load
test:
NoConcatenate
load * inline [
ID, Variable_name, sum
1, x,sum({<ProdType={'PS-E'}>}ActQuantity)
2, y, 100
];
//Concatenating the expressions
ConcatExpressions:
LOAD Concat(sum, ',', ID) As ConcatExpression
Resident test;
//Variable used in Expression
Let vConcatExpressions = 'Pick(ID,' & Peek('ConcatExpression') & ')';
Create a straight table chart, Have dimension as Variable_name and expression as $(vConcatExpressions).
Hope it helps and works for your use case.
Jarl
Have you used a dollar expansion when you use it ?
if you want to create a variable with a formula use
SET varX = SUM({<ProdType={'PS-E'}>}ActQuantity)
Hi
The inline statement looks OK to me, I suggest that you either explain how you are using these fields, or better yet, post a sample.
Jonathan
Hi Felim, Jonathan and Bill. Thank you for your response and I am afraid I haven't figured it out yet.
I am trying to create a new variable for a dimension on a bar graph which only contains a few restricted sums.
I have added a picture of a table box on the left with the Load Inline, and the actual calculation.
So what I expected to see is instead of the text: " SUM ... i want to see the number 1044..
So I tried using a dollar sign so $(SUM({<ProdType={'Meat'}>}ActQuantity)) but it returns a null value .
Not sure if you mean the caption or the column header, but you should just use
=SUM({<ProdType={'Meat'}>} ActQuantity)
HTH
Jonathan
Well the caption doesnt really matter. So I added the sign as well as in my load inline code:
load * inline [
Variable_name, sum
x, =SUM({<ProdType={'Meat'}>} ActQuantity)
y, 100
]
Also if I added a dollar sign infront of it: $(=SUM({<ProdType={'Meat'}>} ActQuantity)). It gave me a null value
If you create the variable mentioned above use =$(varX)
So I got:
set varX = SUM({<ProdType={'Meat'}>} ActQuantity);
load * inline [
Variable_name, sum
x, =$(varX)
y, 100
]
And it still give me the text instead of the actual value:
Weird right.
//Test Load for expression values
test1:
Load * inline [
ProdType, ActQuantity
PS-E, 100
PS-E, 100
];
// Varaible Load
test:
NoConcatenate
load * inline [
ID, Variable_name, sum
1, x,sum({<ProdType={'PS-E'}>}ActQuantity)
2, y, 100
];
//Concatenating the expressions
ConcatExpressions:
LOAD Concat(sum, ',', ID) As ConcatExpression
Resident test;
//Variable used in Expression
Let vConcatExpressions = 'Pick(ID,' & Peek('ConcatExpression') & ')';
Create a straight table chart, Have dimension as Variable_name and expression as $(vConcatExpressions).
Hope it helps and works for your use case.