Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
victor_rainier
New Contributor

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
Valued Contributor III

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

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;

3 Replies
felipedl
Valued Contributor III

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

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;

victor_rainier
New Contributor

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

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

felipedl
Valued Contributor III

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

Glad it helped victor .

Community Browser