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.
Not applicable

function if()

Hello everyone,

I Have a question about if's function: Can I use this function with a FTP in the condition? Because I want to know if my file exist in this FTP or if it doesn't exist pass to another FTP and can I put a LOAD in the "if". And I always have an error with my "if" with the sign after my condition in red.

for a = 1 to FieldValueCount('Code')

let vCountryCode = FieldValue('Code', $(a));

    for m = 1 to FieldValueCount('Id');

      let vUserId = FieldValue('Id', $(m));

      let vPassword = FieldValue('Password', $(m));


      If([ftp://$(vUserId):$(vPassword)@11.111.11.111/DV/AAA%20AAA%20AAA%20-%20$(vCountryCode)%20-%20AAA%20AAA...] <> 'Null' ,

                YourTable:

                LOAD * FROM [ftp://$(vUserId):$(vPassword)@10.198.32.118/DV/AAA%20AAA%20AAA%20-%20$(vCountryCode)%20-%20AAA%20AAA%20AA.xlsx.xlsx]

                (txt, codepage is 1252, embedded labels, delimiter is ';', no quotes, table is Feuil1);

                STORE CONVERT into TABLESv2/VVV.qvd(qvd);


          NEXT, NEXT)


NEXT



I hope this is not too confuse.

Regards

Tags (3)
2 Replies
sebastianlettner
Contributor

Re: function if()

Hi,

try using FileSize()

for a = 1 to FieldValueCount('Code')

let vCountryCode = FieldValue('Code', $(a));

    for m = 1 to FieldValueCount('Id');

      let vUserId = FieldValue('Id', $(m));

      let vPassword = FieldValue('Password', $(m));

    

     if(FileSize([ftp://$(vUserId):$(vPassword)@11.111.11.111/DV/AAA%20AAA%20AAA%20-%20$(vCountryCode)%20-%20AAA%20AAA...] )<> Null()) then

    

                YourTable:

                LOAD * FROM [ftp://$(vUserId):$(vPassword)@10.198.32.118/DV/AAA%20AAA%20AAA%20-%20$(vCountryCode)%20-%20AAA%20AAA%20AA.xlsx.xlsx]

                (txt, codepage is 1252, embedded labels, delimiter is ';', no quotes, table is Feuil1);

                STORE CONVERT into TABLESv2/VVV.qvd(qvd);

     endif

    

     NEXT

        


NEXT

buzzy996
Honored Contributor II

Re: function if()

try this way,

i don't think so qlikview can understand directly, u can create a varaible & paly with tht some how

Community Browser