Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Forcing a dynamic value inline

Having never done this before I will keep it short and sweet.

I have needed to do this a few times building different models so thought I would share it in case someone else can benfit or better yet someone with more product knowledge suggest a better technique.

With this bit of script I am hijacking the INLINE LOAD to force some values in to a table.  In this example I am loading the last three years to later use in another table load as a "WHERE exists(..."

LET i = nothing;

LET CONCATENATE = nothing;

LET CONCATENATE = '';

FOR i = 0 to 2

    if i > 0 then

LET CONCATENATE = 'CONCATENATE';

    endif

$(CONCATENATE)

FilterYears:

LOAD

right(year(now(1))-$(i),2) as [Order Header Order Date Year]

INLINE

[

    Order Header Order Date Year

    1

]

;

   

NEXT i;

LET i = nothing;

LET CONCATENATE = nothing;

Cheers

Oli

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can do it without a for next loop and all those variables:

LOAD  right(year(now(1))-RecNo()-1,2) as [Order Header Order Date Year] AutoGenerate 3;


talk is cheap, supply exceeds demand
Not applicable
Author

now THAT'S a lot simpler!!

I always forget about autogenerate as the only place I use it is in a calendar script which I copy paste from script to script.

Thanks