STRING function with "Error in argument" - VisualCron - Forum

Community forum

CMBI-IT
2019-05-23T11:09:24Z
When I use the syntax: {STRING(IndexOf|{TASK(PrevTask|StdOut)}|T)}, I got "Error in argument".

However, {TASK(PrevTask|StdOut)} is a valid output.


Example: I set the following in task output
===================================
{STRING(IndexOf|{TASK(PrevTask|StdOut)}|F)}
{STRING(IndexOf|12345_20140101_FILE.PDF|_)}
{STRING(Substring|12345_20140101_FILE.PDF|0|5)}
{STRING(Substring|12345_20140101_FILE.PDF|0|{STRING(IndexOf|12345_20140101_FILE.PDF|_)})}

Whole File:
{TASK(PrevTask|StdOut)}





What I got is:
===========
Error in argument
5
12345
12345

Whole File:
10:12:09.358|[main]| INFO|com.cmbi.tap.recon.GenerateTapRecon |================================================================
10:12:09.381|[main]| INFO|com.cmbi.tap.recon.GenerateTapRecon |Start GenerateTapRecon 1.2
...
Support
2019-05-24T15:01:43Z
What exactly does {TASK(PrevTask|StdOut)} contain. Please attach txt file.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
CMBI-IT
2019-05-24T17:02:37Z
Actually any text gives the same result of "Error in argument"

Example of {TASK(PrevTask|StdOut)}:

Whole File:
10:12:09.358|[main]| INFO|com.cmbi.tap.recon.GenerateTapRecon |================================================================
10:12:09.381|[main]| INFO|com.cmbi.tap.recon.GenerateTapRecon |Start GenerateTapRecon 1.2
End of testing text.


  test.txt (1kb) downloaded 23 time(s).
Gary_W
2019-06-03T21:39:58Z
It's because the file contains pipe characters. The pipe is the delimiter for the VisualCron function arguments so when "{TASK(PrevTask|StdOut)}" gets replaced with the file contents containing pipes, the STRING function is then parsed and it seems there are a ton of extra arguments to it!

Luckily you can change the delimiter VisualCron uses by using the syntax below. Pick a character that is not in the file. I used a comma. Put the character you intend to use before the string function name, then use it as the delimiter. I believe this to be a time-bomb though and would not trust this for production, as it's a matter of time before a comma shows up in the file then this blows up. I would like to see this handled differently by VisualCron so this delimiter switching would not be needed.

{STRING(,IndexOf,{TASK(PrevTask|StdOut)},F)}
CMBI-IT
2019-06-05T02:01:38Z
Great! It works now! Thanks a lot.

Agree that VisualCron should revise this design.

Scroll to Top