Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How I can insert the value of a SET-Variable to an INLINE Table?

Good afternoon everyone,

I have a problem trying to compile the results of several set variables in an INLINE table? Is it possible?

E.g.

LET IMRop15= FieldValue('Nume','1');  // It is correctly loaded

SET IMRop17=count({<Open_Year={'2017'}>} [IMR ID]);  // It work on any other part but it is not loading

Tbl_IMRs_Abiertos:

Load * inline [

Yr,IMROp

2015,$(IMRop15),

2016,$(IMRop17)

];

Do you have any suggestions?

Regards

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

Victor,

Do something like this:

I would change the line:

SET IMRop17=count({<Open_Year={'2017'}>} [IMR ID]);  // It work on any other part but it is not loading


because that's a set analysis count expression, and does not work on load statement, you would have to load the year into a table, to:

LoadCount:

Load

     count([IMR ID]) as IMRop17

From [Whatever]

where Open_Year = 2017;


let IMRop = peek('IMRop17',0,'LoadCount');


Tbl_IMRs_Abiertos:

Load

     IMROp as Yr,

     $(IMRop15) as 2015,

     $(IMRop) as 2016

Autogenerate(1);


As an example, I've used the below code:

x:

Load * Inline

[

Nume

1

];

IMRID:

Load * Inline

[

IMR ID,Open_Year

1,2012

2,2013

3,2014

4,2015

5,2017

6,2017

7,2016

8,2011

];

LoadCount:

Load

     count([IMR ID]) as IMRop17

Resident IMRID

where Open_Year = 2017;

let IMRop = peek('IMRop17',0,'LoadCount');

LET IMRop15= FieldValue('Nume','1');  // It is correctly loaded

Tbl_IMRs_Abiertos:

Load

     2015 as Yr,

     $(IMRop15) as IMROp

Autogenerate(1);

Load

2016 as Yr,

$(IMRop) as IMROp

AutoGenerate(1);

drop tables LoadCount,IMRID,x;

View solution in original post

3 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Victor,

Do something like this:

I would change the line:

SET IMRop17=count({<Open_Year={'2017'}>} [IMR ID]);  // It work on any other part but it is not loading


because that's a set analysis count expression, and does not work on load statement, you would have to load the year into a table, to:

LoadCount:

Load

     count([IMR ID]) as IMRop17

From [Whatever]

where Open_Year = 2017;


let IMRop = peek('IMRop17',0,'LoadCount');


Tbl_IMRs_Abiertos:

Load

     IMROp as Yr,

     $(IMRop15) as 2015,

     $(IMRop) as 2016

Autogenerate(1);


As an example, I've used the below code:

x:

Load * Inline

[

Nume

1

];

IMRID:

Load * Inline

[

IMR ID,Open_Year

1,2012

2,2013

3,2014

4,2015

5,2017

6,2017

7,2016

8,2011

];

LoadCount:

Load

     count([IMR ID]) as IMRop17

Resident IMRID

where Open_Year = 2017;

let IMRop = peek('IMRop17',0,'LoadCount');

LET IMRop15= FieldValue('Nume','1');  // It is correctly loaded

Tbl_IMRs_Abiertos:

Load

     2015 as Yr,

     $(IMRop15) as IMROp

Autogenerate(1);

Load

2016 as Yr,

$(IMRop) as IMROp

AutoGenerate(1);

drop tables LoadCount,IMRID,x;

Anonymous
Not applicable
Author

Felip, so many thanks for your help! It worked perfectly!

felipedl
Partner - Specialist III
Partner - Specialist III

Glad it helped victor .