Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Use variables in for loop

Hello,

I'd like to loop over a table of values created in the data load editor, and use the values in the region to dynamically update the bolded text below. I'm not quite sure of the syntax/how to use vContent. Any help is much appreciated! Thanks.

 

vRegions:
LOAD * INLINE [
Region
Europe
Brazil
];

For i = 0 to NoOfRows('vRegions') - 1
let vContent = peek('Region',$(i),'vRegions') ;

Left Join (Table1)
LOAD DISTINCT
%ID, 
Min([Year]) AS [Min Year Europe],
Resident Table2

Where WildMatch([Region],'*Europe*')

Group By %ID;

next i;

1 Solution

Accepted Solutions
Highlighted

Something like this:

For i = 0 to NoOfRows('vRegions') - 1
	Let vContent = peek('Region', i, 'vRegions') ;

	Left Join (Table1)
	LOAD DISTINCT
		%ID, 
		Min([Year]) AS [Min Year $(vContent)],
		Resident Table2
	Where WildMatch([Region],'*$(vContent)*')
	Group By %ID;

Next i
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
Highlighted

Something like this:

For i = 0 to NoOfRows('vRegions') - 1
	Let vContent = peek('Region', i, 'vRegions') ;

	Left Join (Table1)
	LOAD DISTINCT
		%ID, 
		Min([Year]) AS [Min Year $(vContent)],
		Resident Table2
	Where WildMatch([Region],'*$(vContent)*')
	Group By %ID;

Next i
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

Highlighted
Contributor II
Contributor II

Perfect - thanks!