Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Variables in Inline table in qlikview table using let function

Hi,

I have a requirement to show the max of the percent calculated in variables to display using inline tables.

The max of value can change based on the data, hence using variables.

Inline is used as the fields are adhoc.

Attached is the qlikview file for reference.

Let   vsales1    = $(value1) ; (where value1 = max(Percent,1))

Let   vsales2    = $(value2) ; (where value2 = max(Percent,2))

Percent:

LOAD fact_key,

     account,

     Percent

FROM

(ooxml, embedded labels, table is Sheet1);

Sales:

Load * Inline [

id@ sales

aabb1@ sales value is $(vsales1)

aabb2@ sales value is $(vsales2)

aabb3@ sales values is null

](delimiter is '@');

the expected result :

expected result.png

the actual result :

actual result.png

Thanks for your replies! !

1 Solution

Accepted Solutions
MVP
MVP

Re: Variables in Inline table in qlikview table using let function

if I understand, see atachment

7 Replies

Re: Variables in Inline table in qlikview table using let function

I don't think you can use a variable within a inline load. You can do something like this, but I doubt it would be very helpful, because it isn't very scalable.

Let   vsales1    = 60;

Let   vsales2    = 50;

Percent:

LOAD * INLINE [

    fact_key, account, Percent

    1, aa1, 50

    2, aa2, 60

    3, aa3, 40

    4, aa4, 30

    5, aa5, 20

    6, aa6, 10

    7, aa7, 11

];

Sales:

LOAD id,

  If(id = 'aabb1', sales & ' ' & $(vsales1), If(id = 'aabb2', sales & ' ' & $(vsales2), sales)) as sales;

Load * Inline [

id@ sales

aabb1@ sales value is

aabb2@ sales value is

aabb3@ sales values is null

](delimiter is '@');

MVP
MVP

Re: Variables in Inline table in qlikview table using let function

if I understand, see atachment

Re: Variables in Inline table in qlikview table using let function

I guess I was wrong. The variable does work in inline load. Adding that to my list of things I know .

Sorry for guiding you incorrectly and thanks Massimo Grossi‌ for guiding me.

Best,

Sunny

Re: Variables in Inline table in qlikview table using let function

Harshala

This script  works fine :

Let   vsales1    = 1234 ;

Let   vsales2    = 5678 ;

Sales:

Load * Inline [

id@ sales

aabb1@ sales value is $(vsales1)

aabb2@ sales value is $(vsales2)

aabb3@ sales values is null

](delimiter is '@');

So I would suggest you look at how you load your variable.

Do note that in the script the max() function is only valid when used within a load statement, maybe something like this :

Temp:

LOAD

     Max(Percent) as MaxPercent

Resident YourTable ;

LET vsales1    = floor(peek('MaxPercent'));

drop table Temp ;

MVP & Luminary
MVP & Luminary

Re: Variables in Inline table in qlikview table using let function

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable

Re: Variables in Inline table in qlikview table using let function

Thanks a ton both of you (Massimo and Gysbert) !

Both the solutions works, Unfortunately we can mark only one as correct answer.

Not applicable

Re: Variables in Inline table in qlikview table using let function

hi all

this is kalyan i have requirement qlikview to  gemfirexd database is it possible connect windows system.

could plz help me,

thanks and advents

kalyan

obieekalyan50@gmail.com

Community Browser