[Solved] Special Characters in string functions - VisualCron - Forum

Community forum

automagic
2015-01-29T17:35:45Z
Greetings,

I am having some difficulty working with string functions when using special characters. I have a data file in .txt format that I'm working with, it has | (pipe) delimited fields and CrLf style line breaks. The objective is to remove empty lines. The challenge I'm running into is two-fold:

1) VisualCron functions use pipes to separate arguments, so pipe delimited text does not work with string functions

2) How do I reference special characters such as line breaks? \r\n? char(13)char(10)? Is there an escape character?

Thank you in advance for the assistance.
Support
2015-01-30T16:50:42Z
Try using comma as parameter separator in VisualCron. \r\n should work.

Which Variable are you using?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
automagic
2015-02-02T17:04:27Z
I've tried using the String Replace function and Regex Replace function, reading from a file with a File Contents variable.


The contents of the file are very simple:
col1|col2|col3
a|b|c
1|2|3


x|y|z

The desired output would be:
col1|col2|col3
a|b|c
1|2|3
x|y|z

These are a few examples that I've tried and they all result in an output of "Error in argument"

{STRING(Replace|{FILE(Content|C:\testing\pipes.txt)}|\r\n\r\n|\r\n)}
{STRING(Replace,{FILE(Content,C:\testing\pipes.txt)},\r\n\r\n,\r\n)}
{REGEX(Replace,{FILE(Content|C:\testing\pipes.txt)},[\r\n\r\n],[\r\n])}

I've also tried having one task read the file and the next task use the output, this gave the same result of "Error in argument"

{REGEX(Replace,{TASK(PrevTask,StdOut)},[\r\n\r\n],[\r\n])}

Any advice would be greatly appreciated.

Thank you!
thomas
2015-02-03T13:23:44Z
Hi

I ended up at the same conclusion as you. Using the string or regex function won't work on data that contains the pipe delimiter. I could not find an escape character. If this is the case, it's a weakness in VisualCron that should be rectified. There is as workaround, but it's not pretty at all....

1) Read content of file to output
2)Loop over each line from the previous output, and write to new file with 'Append to file' checked. The loop seems to ignore empty lines

Personally I wouldn't go there. I would use a .Net task, or event better, I would create an assembly with a util class that solves these kind of problems. It makes it a lot more reusable. Sorry I couldn't be of any more help!

Thomas
automagic
2015-02-05T16:11:17Z
Can we classify this as a bug or a feature request?
Support
2015-02-09T09:17:43Z
Originally Posted by: automagic 

Can we classify this as a bug or a feature request?



We are changing this to a Feature request. Proposed solution is to have the parameter delimiter character in Server settings. Alternatively, maybe temporary use another delimiter by passing the deliminiter as first character after the paranthesis. We will investigate this. Thanks.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
automagic
2015-02-09T16:03:20Z
Thanks! Please keep me posted!
Support
2015-02-10T09:10:39Z
Please test this version: http://www.visualcron.co....aspx?g=posts&t=4676 

[FEATURE] Client/Server: Variables->Any non-letter character can be used as parameter split character. Start by using the first character in argument that you want to use, for example: {FILE(@Content@c:\textfile.txt)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
HermanM
2016-01-06T12:35:04Z
Hi,

I'm workign with Visual Cron Client 7.6.4
I have a file that has on the first line the value "DEV_Net Short Position import MIFID|96" (duoble quotes only to indicate begin and end of the string value, they are not part of it)
I want to get this whole vallue (so excluding duoble quotes).

Not working:
{STRING(FirstLine|{FILE(Content|{TRIGGER(Active|LastTrigger|File.Result.FullPath)})})}
{STRING(@FirstLine@{FILE(@Content@{TRIGGER(@Active@LastTrigger@File.Result.FullPath)})})}

What is the trick here?

Thanks.

ErikC
2016-01-06T13:27:41Z
Originally Posted by: Support 

Try using comma as parameter separator in VisualCron.



{STRING(FirstLine,{FILE(Content,{TRIGGER(Active,LastTrigger,File.Result.FullPath)})})}

Why? Because your filename contains a '|' wich is used in the visuacron variables.

Regards,
Erik
Uses Visualcron since 2006.
HermanM
2016-01-06T14:16:06Z
Hi Erik,
Unfortunately that did not work...
I also used the @ sign as it was in the Feature request with version 7.6.0....
I tried double quoting...
It just seems not possible?
Support
2016-01-06T14:37:26Z
Originally Posted by: HermanM 

Hi Erik,
Unfortunately that did not work...
I also used the @ sign as it was in the Feature request with version 7.6.0....
I tried double quoting...
It just seems not possible?



This feature was introduced in 7.7.0.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Sylv@in
2016-01-19T03:05:07Z
Originally Posted by: Support 

Originally Posted by: HermanM 

Hi Erik,
Unfortunately that did not work...
I also used the @ sign as it was in the Feature request with version 7.6.0....
I tried double quoting...
It just seems not possible?



This feature was introduced in 7.7.0.


What about using the pipe in a regular expression?
Support
2016-01-19T09:13:39Z
Originally Posted by: Sylv@in 

Originally Posted by: Support 

Originally Posted by: HermanM 

Hi Erik,
Unfortunately that did not work...
I also used the @ sign as it was in the Feature request with version 7.6.0....
I tried double quoting...
It just seems not possible?



This feature was introduced in 7.7.0.


What about using the pipe in a regular expression?



Same way, start with anothers argument separator character, like this:

{REGEX(@Replace@a b c d@\s+@, )}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top