Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to load the data within a loop. The following is my case,
General logic:
my_data:
ResultSet resultSet = "Select distinct designation, location from employee";
for(int i = 0; i < resultSet.count; i++) {
load emp_id,
name,
designation, location, salary;
sql select * from employee where location = "resultSet.location" , designation = "resultSet.designation";
}
I want the above logic should be done while loading the data. Every time it should concatenate/append with the existing data.
Please help me to get this done.
Hi
I think this is what you are looking for:
tmpLocationDesignation:
LOAD Distinct
Location,
Designation
From employee;
For i = 1 To NoOfRows('tmpLocationDesignation')
Let zLocation = Peek('Location', i, 'tmpLocationDesignation');
Let zDesignation = Peek('Designation', i, 'tmpLocationDesignation');
my_data:
load emp_id,
name,
designation,
location,
salary;
sql select * from employee
where location = '$(zLocation)' And designation = '$(zDesignation)';
Next
Set zLocation =;
Set zDesignation =;
Drop Table tmpLocationDesignation;
HTH
Jonathan
can you attach a file ?
Hi Rajaram,
"For next" as well as "For each next" is described with examples in the reference manual. If you have done a full installation of QlikView you can find it here :
C:\ProgramData\QlikTech\QlikView Documentation\Reference Manual
/Ida
Hi
I think this is what you are looking for:
tmpLocationDesignation:
LOAD Distinct
Location,
Designation
From employee;
For i = 1 To NoOfRows('tmpLocationDesignation')
Let zLocation = Peek('Location', i, 'tmpLocationDesignation');
Let zDesignation = Peek('Designation', i, 'tmpLocationDesignation');
my_data:
load emp_id,
name,
designation,
location,
salary;
sql select * from employee
where location = '$(zLocation)' And designation = '$(zDesignation)';
Next
Set zLocation =;
Set zDesignation =;
Drop Table tmpLocationDesignation;
HTH
Jonathan