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


kenigm
2009-02-05T21:27:05Z
Hello,

I am trying to get a portion of a string from a file that contains 1 line like
date operator jobcode jobname+
the length of the jobname can vary, but it always begins in the same spot, in this case 22 and it always ends with "+"

so I have a varialble
{STRING(LastIndexOf,{FILE(Content,C:\files\out\jobNAME.dat)},+)}

that returns 29 which is the column number of the string delimiter, now I would like to calculate the length of the jobname by subtracting 22 and then use the result: 7 as an argument to the substring function below

{STRING(Substring,{FILE(Content,C:\files\out\jobNAME.dat)},22,7)}

which should return "jobname"

The idea is to have a variable that contains the jobname no matter how long or short it is.

Can you help me, please??

](*,)
Sponsor
Forum information
Support
2009-02-05T21:37:54Z
We don't support operators there.

What about using this function instead - it will always return jobName:

{PATH(GetFileNameWithoutExtension,GetFileName,C:\files\out\jobNAME.dat)})}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
kenigm
2009-02-05T23:10:21Z
Thanks for your response!

The file name that I used in the File(content) was misleading, the name of the file has no relation to the Jobname string that I am trying to extract.

Is there someway to use the following as an argument for the substring length?

{MATH(Subtract|Integer|{USERVAR(varIndex)}|22|#)}

where varIndex ={STRING(LastIndexOf,{FILE(Content,c:\files\out\jobNAME.dat)},+)}
unfortunately the {MATH(Subtract|... doesn't work, is it because the {USERVAR(varIndex)} is the wrong type??
Support
2009-02-05T23:18:50Z
It seems like you are trying to make something simple very hard here :)

Instead of going through your UserVariable I would use the Variables directly instead. And maybe, even this can be done within VisualCron it may not be as efficient as just writing a batch file instead or use other scripting.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top