Rungano - I'm not sure I fully understand your question, but if you have instances where you do not want to execute the subroutine if it finds a specific folder name or filename, then yes, you can use standard if statements and Exit Sub; if needed.
Consider something like -- I want to load all the files within the subfolders of the PARENT folder except subfolder "jirafa". You can check the folder name before you call the next subroutine.
That is correct. But I have this instance where I have many different Subs. Therefore on testing my script I would like to execute other Subs and Skipping others. Therefore I would like.to set Variable LoadFolder = 'Y'. So that the different Subs I want to execute and Load Data I will Set the parameter to Y ten they will b executed and when I Change it then it will skip it
I suggest you open a separate thread with this question. You will get more answers then. Tag me in it, and I will try to answer.
Further, you need to explain how you want to assign values to the variables vWhere, vNOT and vL.FieldConcat. E.g. on what information would you base the decision to assign 'NOT' or an empty string to vNOT? And where would you find this information?
Sorry for the delay, my Question was how could load some QVD'S from the same folder, the developer will assign value to the variables if the developer wants to concatenate or not the information in QVD'S and if they want to load with the condition WHERE EXISTS() or WHERE NOT EXISTS().
vNOT only has the value 'NOT' or null;
vWhere any value that isn't null;
vL.FieldConcat the fieldname that we want concatenate with the condition EXISTS();
I found the solution changing the order of table name with IF/ELSE conditions:
for each File in FileList('$(vG.Path.QVD.Layer1)\M_$(vL.Tabla)*.qvd')
I'm having a problem with the script not closing out/ending. Below is my script. I get as far as the picture below, it seems to have all the data, however the script never advances and the script execution progress just stalls out.
Any idea what i am missing?
SET vConcatenate =; SUB ScanFolder(ROOT) FOR EACH FileExtension in 'xlsx' FOR each FoundFile in FileList( ROOT & '\*.' & FileExtension )
First 1 LOAD A FROM [$(FoundFile)] (ooxml, no labels, header is 1 lines, table is Summary) WHERE(not IsNull(A));
HEADER: First 1 LOAD SubField("A",' (',1) AS SITE_NUMBER RESIDENT TEMP_HEADER; LET vSITENUMBER = Peek('SITE_NUMBER');
DROP TABLE HEADER; DROP Table TEMP_HEADER;
FIRST 1 LOAD A FROM [$(FoundFile)] (ooxml, no labels, table is Summary) WHERE(not IsNull(A));
HEADER: LOAD SUBFIELD(SUBFIELD("A",'(',2),' ',1) AS BEGIN_DATE , SUBFIELD(SUBFIELD("A",'Through ',2),' ',1) AS END_DATE
LET vSTARTDATE = Peek('BEGIN_DATE'); LET vENDDATE = Peek('END_DATE');
DROP TABLE TEMP_HEADER; DROP TABLE HEADER;
CMOP_DETAILS: LOAD $(vSITENUMBER) AS SITENUMBER ,Date($(vSTARTDATE),'M/D/YYYY') AS STARTDATE ,Date($(vENDDATE),'M/D/YYYY') AS ENDDATE ,CMOPID ,NDC ,VAPrintName ,UnitCost ,NumberRX ,QTY ,TotalCost FROM [$(FoundFile)] (ooxml, embedded labels, header is 5 lines, table is [$(vSITENUMBER)]);
SET vConcatenate = Concatenate; NEXT FoundFile Next FileExtension
for each SubDirectory in dirlist( Root & '\*' ) call ScanFolder(SubDirectory) next SubDirectory end sub