Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
is it possible to evaluate variable in load statement?
Say
SET vKPI_Fomula = 'sum(Revenue)';
LOAD
'$(KPI_Nr)' AS KPI_nr,
'=$(=vKPI_Fomula )' AS KPI_VALUE,
Declaratie_KlantOrganisatie_code AS KlantOrganisatieId,
[Declaratie Year-quarter] AS KPI_QrtrKey
RESIDENT tmpDeclaratie
GROUP BY Declaratie_KlantOrganisatie_code,
[Declaratie Year-quarter];
Thanks,
Dror
"Dollar-sign expansions are definitions of text replacements used in the script or in expressions", so yes, it is possible.
But I think you need something like
LOAD
'$(KPI_Nr)' AS KPI_nr,
$(vKPI_Fomula ) AS KPI_VALUE,
...
since you want QV to evaluate the KPI and not store your literal / string as KPI_VALUE.
Hope this helps,
Stefan
edit:
Maybe remove also the single quotes in your SET statement.
"Dollar-sign expansions are definitions of text replacements used in the script or in expressions", so yes, it is possible.
But I think you need something like
LOAD
'$(KPI_Nr)' AS KPI_nr,
$(vKPI_Fomula ) AS KPI_VALUE,
...
since you want QV to evaluate the KPI and not store your literal / string as KPI_VALUE.
Hope this helps,
Stefan
edit:
Maybe remove also the single quotes in your SET statement.
Yes, you could do that
Check this code in a separate QVW for an example
set formula = ' sum(id) as mySum ';
test:
LOAD $(formula) INLINE [
id,test
1,aa
2,bb
];
I don't know how useful it will be, as I often use sums etc with group-by clauses...
Perhaps for your requirement it is handy...