Use foldername of a triggered file - VisualCron - Forum

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


RJPAAPE
15 years ago
Hello,

I would like to know if there is a possibility to use a part of the folder name of a triggered file.

I have this structure:
D:\RFA\1001\1900001.xml
D:\RFA\1002\1900005.xml
D:\RFA\1004\1900002.xml
etc..

I would like to move/copy them to this structure:
D:\PDA\1001\1900001.xml
D:\PDA\1002\1900005.xml
D:\PDA\1004\1900002.xml
etc..

I know how to use the triggered file name:
{TRIGGER(Active,LastTrigger,File.Result.Name)}

But the variable for the triggered folder name is not working:
D:\RFA\{TRIGGER(Active,LastTrigger,File.Result.Folder)}\{TRIGGER(Active,LastTrigger,File.Result.Name)}

Any suggestion?
Is this possible with one job?


Best regards,
RJP

Sponsor
Forum information
ErikC
15 years ago
Hi,

I tried this myself. Setting a variable to the result of the trigger (folder).
The variable isn't touched at all. In the variable window I can see a value however.

I used the last trigger functionality and also the direct number to the trigger in the variable. Both with no success.

Is this a bug? (I used 5.5.9 (downloaded 5.6.0 though))

Regards,
Erik
Uses Visualcron since 2006.
Support
15 years ago
We tested this.

We could not see any problem with the actual Variable but there is a problem setting (updating) another Variable with this problem?

Erik, what did you test?

We tested to use the folder variable and write it to a file.

RJPAAPE, I am not sure what you are trying to do but if the next Task is a Copy files Task you should use the folder Variable in one field and the name (file mask) in the other field.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
15 years ago
I re-downloaded 5.6.0, and did the same test:

I have a job with a file trigger on a folder create and changed, filename and size are the settings.
The only task I use is the set variable task and here is the string I use for this value:

i tried it with a direct link:
{TRIGGER(1315debb-a5cc-43b2-a814-7bea15a1265f,e5b6f816-0839-40fc-9efb-25b9dd0cb43a,File.Result.Folder)}

and this way:

{TRIGGER(Active,LastTrigger,File.Result.Folder)}

Both gave me the output:

Variable 'test' was updated to: nothing here

When I go to the variable window and enter the above strings I see the result:

f:\temp

That was the directory where I put my file and the trigger location.
I expected to be visible in the variable also.

Also in the variable window I check the value of my test variable (string) and it has no value at all.

Regards,
Erik
Uses Visualcron since 2006.
Support
15 years ago
It is confirmed the Set Variable bug. However, RJPAAPE does not seem to use that.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
15 years ago
RJPAAPE wrote:

But the variable for the triggered folder name is not working:
D:\RFA\{TRIGGER(Active,LastTrigger,File.Result.Folder)}\{TRIGGER(Active,LastTrigger,File.Result.Name)}



The File.Result.Folder gives a whole path so using it in conjunction with d:\RFA\ would give you something like:

D:\RFA\D:\RFA\filename

There can be only one driveletter in a path.
You might want to check/change this.

Regards
Erik
Uses Visualcron since 2006.
RJPAAPE
15 years ago
Hello Henrik,

I put printscreens of the copy job in this post.
Hope this helps.

RJPAAPE attached the following image(s):
ErikC
15 years ago
Destination folder contains two direveletters at the moment with the {TRIGGER(Active,LastTrigger,File.Result.Folder)} and the c:\temp\ in front of it.

Donno if the {TRIGGER(Active,LastTrigger,File.Result.Folder)} should only contains the folder or the whole path, but I think this is the issue here.

Regards
Erik
Uses Visualcron since 2006.
Support
15 years ago
RJPAAPE: Yes, this is the problem, with the double path. You cannot use it that way. You might want to hard code that folder path, or use some function to get that last part, or request that you want Folder name Variable implemented instead.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
RJPAAPE
15 years ago
Hello,

Indead I need the Folder name Variable instead of the Folder path.
There is no standard option for this in VC?

Best regards,
RJP
Support
15 years ago
No, not right now.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
15 years ago
You can however remove the driveletter and the : by using this variable conjunction:

{STRING(Right|{TRIGGER(Active,LastTrigger,File.Result.Folder)}|{MATH(Subtract|Integer|{STRING(Length|{TRIGGER(Active,LastTrigger,File.Result.Folder)})}|2|0)})}


It removes two characters from this left side of the path.

If the path was c:\temp\win\blabla you will get \temp\win\blabla. This you can use to put it behind your own (other) driveletter. (don't forget the colon)

Regards
Erik
Uses Visualcron since 2006.
Support
15 years ago
Just found that you can use the following Variable for this:

{PATH(GetFileName|C:\sourcefiles\code\VisualCron\bin\VisualCronClient.EXE)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
RJPAAPE
15 years ago
Hello Henrik,

This option {STRING(Right|{TRIGGER(Active,LastTrigger,File.Result.Folder)}|{MATH(Subtract|Integer|{STRING(Length|{TRIGGER(Active,LastTrigger,File.Result.Folder)})}|2|0)})} works.

Thanks a lot.

Best regards,
RJP
Support
15 years ago
In your case, this should work and be more efficient:

{PATH(GetFileName|{TRIGGER(Active,LastTrigger,File.Result.Folder)})}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
15 years ago
He loves mine over yours..😝 YES!

{PATH(GetFileName|{TRIGGER(Active,LastTrigger,File.Result.Folder)})} is better however I agree. You have to include the 1st backslash however.

Regards
Erik
Uses Visualcron since 2006.
Support
15 years ago
😁 I like your solution too Erik 😎
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top