Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Call the SUB only if any new dates exists.

We are scanning the file system to find out the QVD Name and the QVD Date of the QVD's from a folder. The format the QVD is something like "QVDNAME.YYYY_MM" and "QVDNAME.YYYY_MM_DD".

for each zFormat in 'qvd'
    for each zFile in filelist ('C:\QV\Data' &zExt)
     LET zDate= subfield('$(zFile)', '.', 2);
     [Temp]:
     Load '$(zFile)' as QVDNAME, subfield('$(zFile)', '.', 2) as QVDDATE autogenerate 1;
    next zFile
   next zFormat

Also we have seperate QVD which contains the list of QVD's in a folder in the same format as above.

(i.e)
QVDNAME
-------

QVDNAME_2013_12.qvd
QVDNAME_2013_11.qvd
.
.
.

What I need is, I want to check whether is there is any dates which exists in the above scan file code but not exists in the above QVD(Which contains the list of QVDNAME which was already there).

If there is any new QVD which exits but not there in the above QVD then I need to call one SUB, if not I don't want to call the SUB.

Please help me on this...

4 Replies
orital81
Partner - Creator III
Partner - Creator III

Hi, as far as my understanding you have 2 tables:

1. QVD Files from Folder A (from scan file code), lets call it Table_A

2. QVD Files from Folder B (from the 2nd QVD list), lets call it Table_B

If you left join Table A to Table B (by QVDDATE) then you can identify which are missing in Table_B

by the null value in that table.

For Example:

BothSources:

LOAD * INLINE [

    A, B1

    aaa, bbb

    aa1, bb1

    aa2, bb2 

];

Left join

LOAD * INLINE [

    A, B2

    aaa, bbb

    aa1, bb1

];

NoConcatenate

OnlyIn_A:

LOAD * Resident BothSources

Where IsNull(B2);

Drop Table BothSources;

qlikviewforum
Creator II
Creator II
Author

Basically I want to call a subroutine only if any qvd which exists in scan file system code but not there in QVD list(qvd). If not I don't want to call the subroutine. Anyway I check your code and update you on that.

qlikviewforum
Creator II
Creator II
Author

Hi Ori,

Hope my requirement is understandable. It is not working! Sorry..

Hi All,

Any thought from any one on this?

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

To call a sub, but exclude the contents of the QVD list (let's call that filer QvdList.qvd), do the following:

LOAD QvdName As LoadedQvd

From QvdList.qvd (qvd)

;

For Each zFile in FileList ('C:\QV\Data\*.qvd')

        If Not Exists(LoadedQvd, SubField(zFile, ''\', -1)) Then

                Call Process(zFile)

        End If

Next zFile

Drop Field LoadedQvd;

HTH

Jonathan

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