Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
QV_learner
Contributor II
Contributor II

expression in load * inline

Hello!

 

Can anyone please tell me if we can write expression in Load * Inline[];?

If yes, please give some example.

 

Thanks and Regards,

Vivek

8 Replies
Gysbert_Wassenaar

LOAD *, Ceil(123/45) as Number [
Field1
A
B
C
];

talk is cheap, supply exceeds demand
VishalWaghole
Specialist II
Specialist II

You have to write it like preceding load like below,

LOAD *, sum(Sales) as Sales [
Field1, Sales
A, 10
B, 23
C, 34
A, 12
C, 54
];

Regards,
Vishal
QV_learner
Contributor II
Contributor II
Author

Thanks;

But my problem is, I want to print each value by different expression.

Let's say,

Load * Inline

[

     Col, Col1, Col2

     A, Expression1, Expression2

     B, Expression1, Expression2

];

where A and B are any text.

 

marcus_sommer

A concrete example of which data should be loaded and should return which results would be quite useful.

- Marcus

QV_learner
Contributor II
Contributor II
Author

Load * Inline
[

temp, high

temp1, count({$<HighAcceptPriority={1},HighRejectPriority={1}>}ProductID)

]

this is my expression. 

But in the table it's giving me output as

temphigh
1count({$<HighAcceptPriority={1},HighRejectPriority={1}>}ProductID)

 

where 1 is value of temp1 in temp column.

 

Please suggest some solution!

 

Thanks and Regards,

Vivek

marcus_sommer

From a Qlik point of view it's just a string and won't be evaluated in any way. The only possibility to evaluate such string is the use from a $-sign expansion like: $(=YourExpressionField) but it creates an adhoc-variable what meant it will be evaluated only once before the calculations of the object are executed and applied there for each row.

In short: your approach won't work. Of course there are ways to bypass it but they are neither trivial nor have they much benefit in the most usecases. Therefore my suggestion: just keep it simple by writing all needed expression there where you need them and switching to the really advanced stuff only if there is really no easier way.

- Marcus

QV_learner
Contributor II
Contributor II
Author

Thanks Marcus!

Regards,

Vivek

panosalexand
Creator
Creator

Hello all,

I was facing the same issue but as an alternative solution I managed to do the following:

 

MetricShowExpression:
LOAD * INLINE
[Metric, ExpressionTable
Orders, vOrders
Invoices, vInvoices
Shipments, vShipments
];


LET vExpressionTableAux = '=ExpressionTable';
LET vExpressionTable = '=$'&'(vExpressionTableAux)';

 

You will be able to show in a table the metrics (Orders,Invoices,Shipments) but not all together. Add in the expression Definition $(vExpressionTable)

For my example I used a listbox and when I select Orders display vOrders and so on. 

I hope my example helped you. 

-Panos