I need to read an xml file from a location on a daily basis.
File Format: Location_YYYYMMDDHHMISS_UniqueID
Ihave assigned a global variable pointing to this file and based on previous variables it can read ‘Location’ and the ‘Unique ID’ part of the XML file.
I can handle the YYYYMMDD datetime part of it and want to use wildcard characters for the HHMISS part of the datetime in the file as the time when the file is generated and the execution of the DI job is different.I am getting an error most likely because of the syntax.
I tried using the * but it still does not take it as a wildcard entry. This is probably becoz of single quotations i have at the beginning and at the end of the value assigned to the variable.
Is there anyway i can bypass the HHMISS part of the file ??
We’ve done similar, and the trick was to use a directory function to generate a list of files - that should definitely take the wildcards. You then just need to step thru the list of file names returned by that call - that will give you all the filenames, something that you can use to open each file.
Not sure what you’d want to plug in, but in VB I think it’s an ADir call.
see your point, you are using the wildcard inside a global variable, not specifying it as parameter.
One version of the code bdouglas is talking about is in the link I mentioned above: https://boc.sdn.sap.com/node/5239
This document uses wit_for_file() function to fetch on filename after the other instead of an exec(‘cmd.exe’, ‘dir’, 8 );.
Here’s an example of something I did a LONG time ago, may be useful as pseudocode
' set up an array and populate it with file names (directories)
declare vars(1)
ok=adir('vars',path+'*.*','D')
badval=.f.
' for each item in the array, do some action
for x=1 to alen(vars,1)
variableX= ars(x,1)
' etc, etc, etc
next x
The syntax may need a lot of work, but there are versions of this in most languages - use your wildcards when you populate the array of file names, then step thru those names to do your work.