Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I Try to make a Loop in my QlikView Script but it will not work.
Can someone tell my what i do wrong.
UITVOERDERS:
LOAD
SUBFIELD(REPLACE(Subfield(item_lijst,';',1), ',', ';'), ';',1) AS Uitvoerder,
SUBFIELD(REPLACE(item_code_lijst, ',', ';'), ';',1) AS Uitvoerder_Code
;
SQL SELECT *
FROM mtc_rubriek
WHERE rubcode = 'PROJ_006';
UITVOERDERS:
LOAD
SUBFIELD(REPLACE(Subfield(item_lijst,';',1), ',', ';'), ';',2) AS Uitvoerder,
SUBFIELD(REPLACE(item_code_lijst, ',', ';'), ';',2) AS Uitvoerder_Code
;
SQL SELECT *
FROM mtc_rubriek
WHERE rubcode = 'PROJ_006';
UITVOERDERS:
LOAD
SUBFIELD(REPLACE(Subfield(item_lijst,';',1), ',', ';'), ';',3) AS Uitvoerder,
SUBFIELD(REPLACE(item_code_lijst, ',', ';'), ';',3) AS Uitvoerder_Code
;
SQL SELECT *
FROM mtc_rubriek
WHERE rubcode = 'PROJ_006';
This is the script total write down but than 10 times.
I Want to make a loop of it.
UITVOERDERSAANTAL:
LOAD
COUNT(DISTINCT(UitvoerderAantal)) AS MAXUITVOERDERS;
LOAD
SUBFIELD(REPLACE(Subfield(item_lijst,';',1), ',', ';'), ';') AS UitvoerderAantal
;
SQL SELECT *
FROM mtc_rubriek
WHERE rubcode = 'PROJ_006';
LET V_MAXUITVOERDERS = MAXUITVOERDERS+1;
DROP TABLE UITVOERDERSAANTAL;
FOR i =1 to $(V_MAXUITVOERDERS)-1
LET LOOP = $(i);
//EXIT SCRIPT;
UITVOERDERS:
LOAD
SUBFIELD(REPLACE(Subfield(item_lijst,';',1), ',', ';'), ';',$(LOOP)) AS Uitvoerder,
SUBFIELD(REPLACE(item_code_lijst, ',', ';'), ';',$(LOOP)) AS Uitvoerder_Code
;
SQL SELECT *
FROM mtc_rubriek
WHERE rubcode = 'PROJ_006';
//STORE UITVOERDERS INTO Q:\Rapportages\Peter\UITVOERDER.QVD;
NEXT i
//DROP TABLE UITVOERDERSAANTAL;
EXIT SCRIPT;
BUT it doesn't work, can somebody help my with this question?
One remark:
Best,
Peter
One remark:
Best,
Peter
I'm not quite sure what you are trying to do but I think you don't need these complex loop then by using from subfield within a load and without the third parameter it will automatically loop through these field and generate for each item a record.
- Marcus