Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Is there a way assign an aggregated load statement to a variable?

Hi,

I want to know if there is any way of assigning an aggregated load statement to a variable just as in SQL

Thanks in advance.

Example:

DECLARE @vAnioCY INT=2018;

DECLARE @vECOCY FLOAT;

SET @vECOCY=(

SELECT AVG(ECO_Icalificacion)

FROM TH_EncuestaECO E

INNER JOIN Td_Tiempo T ON E.TPO_CFecha=T.TPO_CFecha

WHERE TPO_CAnioFiscal=@vAnioCY

)

1 Reply
Highlighted

ABC:

Load *;

SQL

SELECT AVG(ECO_Icalificacion) as Avg_Value

FROM TH_EncuestaECO E 

INNER JOIN Td_Tiempo T ON E.TPO_CFecha=T.TPO_CFecha 

WHERE TPO_CAnioFiscal=@vAnioCY;

Let vAvg = Peek('Avg_Value',0,'ABC');

Or

Let vAvg = Fieldvalue('Avg_Value',1);

Drop table ABC;

Use the above variable in different tables.