Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Grimdal
2017-11-15T16:10:52Z
Not sure if this is a Bug, or I missunderstood how it works

I have a requirement to rename files in a specific way..

short background, we have sales order data in files downloaded from our websites, which we then push up to our backend ERP using VisualCron 8.2.9
we recently setup a new country website and have a new set of files coming in, but due to other considerations rather than reprogram our
existing ERP to handle these new prefixed files, it will be easier to rename them to an existing format to be processed (we are currently in the process of changing ERP systems, hence the reluctance to change the existing programming).

the files coming in are in the following format

XddmmyyA.file

where X is the prefix for the country
ddmmyy is the date the file is created
A is the hour prefix the file was created so 00:05 is A, 01:05 is B etc

I need to change the prefix from I (india) to B (UK), but to stop the possibility of duplicate files with the UK site, I also want to change the Year to 37
having spoken to VisualCron support, I was told using the mask B????3* would work, however when I tried this it changed the file from

I141117A.file to B3I141117A.file, to it just prefixed the existing file name with B3....

I have got around this by setting up 2 different tasks run one after the other.
the first uses the mask of * with a post process doing a replace of 17 to 37 (of course that will also change day 17 to 37 as well as the year, but in this instance is not a problem as the date is literally only used as a name for temporary use files)
the 2nd task uses the mask of * with post process doing a replace of I to B, (this will of course change the prefix, but it will also change the 01:05 file which is suffixed with B, thus potentially leading to a duplicate file when it processes the XddmmyyI file the 09:05 file, to get around this I told the task to not override the file)

So my questions are should the mask of B????3* have worked in the first place (the potential bug)?
and is there a better way of doing what I need than my solution of 2 tasks?
and lastly, if as I suspect there is a duplicate when trying to rename the 09:05 file, what happens to the file is it
a) renamed with a suffix on it like _1 or something similar or
b) is it left in its original state

Thanks for any help in improving my understanding of VisualCron
Sponsor
Forum information
thomas
2017-11-16T09:44:23Z
The format is fixed, so you know that the 'I' is the first letter, and the year is in position 6-7. So I would just concatenate strings

From: I141117A.file
To: B3I141117A.file

'B' + Position 2-4 in From + '37A.file'

If you want to avoid hardcoding 37, just extract the 17 from position 6-7 and add 20 to it.

If this was unclear I can show with VC functions.
Gary_W
2017-11-17T16:12:44Z
Use this for your new name mask: "B????3??.*"

I suspect you need to allow for each position on either side of the decimal? Once you use the question mark? Not real sure but this works.
Scroll to Top