Skip to Content
avatar image
Former Member

Escape Character creating problem in BODS, tried all listed solutions so need help?

Hi All,

When i run below script it prints extra \ in logs.

$FILE_NAME = 1;
print('C:\Users\shipar02\Desktop\SERVICES\[$FILE_NAME].txt');

OutPut

PRINTFN 05/07/2017 14:46:00 C:\Users\shipar02\Desktop\SERVICES\\1.txt

I want to get rid of extra \ (highlighted bold)which get inserted which create problem in exec function used later in Job.

And if I uses \\\, it prints all \\\ in print results.

Thanks,

Parijatam

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 05, 2017 at 08:07 PM

    Hi,

    What version of Data Services are you using and how is your variable defined? I ran a quick test in DS 4.2 SP8 with the following:

    $FILE_NAME = 1;
    print('C:\Users\shipar02\Desktop\SERVICES\[$FILE_NAME].txt');

    and I don't see an extra \ printed in the trace. I tried using datatypes of varchar and int for the variable and it works correctly in both cases. Not exactly sure why you are seeing a different result.

    Doug

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I am using DS 4.2, SP5.

      $G_INFLDR= 'C:\Users\shipar02\Desktop\SERVICES\$FILE_NAME.txt';

      Print ( [$G_INFLDR]);

      Still prints

      C:\Users\shipar02\Desktop\SERVICES\\1.txt

      $FILE_NAME is integer variable and $G_INFLDR is varchar.