Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
dirk1955
Contributor

Scripting problem

Hi, i use the following code:

Files:

LOAD

    *,

    RowNo() as RijNr

Resident FilesTemp Order By RepDate asc;

DROP Table FilesTemp;

LET vX = Peek('RijNr');

FOR x = 1 to vX

    LOAD

        X,

        RepDate,

        'F' as filter

    Resident Files Where RijNr = $(x);

LET vDate = Peek('RepDate');

LET vFile = Peek('X');

IF x = 1 then

DataPolyvalentPersoneel:

     

        LOAD num(IDF,'000000000') as IDF,

             num(IDF,'000000000') as IDFPoly,

             text(num(IDF,'000000000')) as IDFData,

//             NUM(IDF, '000000000') AS IDF,

             left(right(IDF,5),2) as Jaar_ID,

             NUM(%/100,'#,##') AS %,

             'OA' as SoortOperator,

             Kostenpl.,

             'A' AS Groep,

             'D' AS [D-post/Pool],

            % as "FTE Reporting",

            num(Inzetbaar/100,'0,00') as [$(vDate) IZ],

            date(right(SubField(FileName(),'_',1),2)&'/'&Mid(SubField(FileName(),'_',1),5,2)&'/'&Left(SubField(FileName(),'_',1),4))as DateIZ,

             if(% = Inzetbaar,'Y','N') as [%=IZ],

             [Bew uit] as [IZ Bew uit],

             date(Datum) as [IZ Datum]

        FROM

       

        (biff, embedded labels, table is [Lijst O_A$]);

ELSE

Add

    LOAD

    num(IDF,'000000000') as IDF,

             num(IDF,'000000000') as IDFPoly,

             text(num(IDF,'000000000')) as IDFData,

//             NUM(IDF, '000000000') AS IDF,

             left(right(IDF,5),2) as Jaar_ID,

             NUM(%/100,'#,##') AS %,

             'OA' as SoortOperator,

             Kostenpl.,

             'A' AS Groep,

             'D' AS [D-post/Pool],

            % as "FTE Reporting",

            num(Inzetbaar/100,'0,00') as [$(vDate) IZ],

            date(right(SubField(FileName(),'_',1),2)&'/'&Mid(SubField(FileName(),'_',1),5,2)&'/'&Left(SubField(FileName(),'_',1),4))as DateIZ,

             if(% = Inzetbaar,'Y','N') as [%=IZ],

             [Bew uit] as [IZ Bew uit],

             date(Datum) as [IZ Datum]

        FROM

       

        (biff, embedded labels, table is [Lijst O_A$]);

END If

NEXT;

The field X of the table Files: contains the list of filenames he has to process.

The first time, x = 1 hi goes through the code everything OK, hi retrieves vFile and vDate,

after the NEXT statement x becomes 2, this is OK, and then for vDate and vFile he retrieves Null for both variables???

How comes?

Thx in advance

1 Reply
fernando_tonial
Valued Contributor

Re: Scripting problem

hi, you can change your command FOR x for FOR Each.

See my example:

Files:

LOAD

    Concat(Chr(39)&RowNo()&Chr(39),',') as RijNr

Resident FilesTemp Order By RepDate asc;

DROP Table FilesTemp;

LET vX = Peek('RijNr');

FOR each x in vX

Best Regards.

Tonial.

Community Browser