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

Formula/Variable in Load*Inline

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?

1 Solution

Accepted Solutions
Not applicable
Author

//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.

View solution in original post

12 Replies
Anonymous
Not applicable
Author

Jarl

Have you used a dollar expansion when you use it ?

Not applicable
Author

if you want to create a variable with a formula use

SET varX = SUM({<ProdType={'PS-E'}>}ActQuantity)

jonathandienst
Partner - Champion III
Partner - Champion III

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

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

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 .

picture.png

jonathandienst
Partner - Champion III
Partner - Champion III

Not sure if you mean the caption or the column header, but you should just use

     =SUM({<ProdType={'Meat'}>} ActQuantity)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

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
]

picture.png

Also if I added a dollar sign infront of it:  $(=SUM({<ProdType={'Meat'}>} ActQuantity)). It gave me a null value

Not applicable
Author

If you create the variable mentioned above use =$(varX)

Not applicable
Author

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:

picture.png

Weird right.

Not applicable
Author

//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.