Skip to content


vb to c# conversion in map

gp_usr asked 10 years ago
when trying to create/update a map in smartconnect using c# as the scripting language, it gives me an error on the restrictions tab in line map:
"unrecognized escape sequence NewLine in constant". When i change it back to it works fine. Has anyone come across such scenario?

Ruaan Jonker replied 10 years ago


C# and VB syntax differ.
So if you change between the two you will need to correct the syntax for each script on that map.

Please can you give me an example of this script so I can take a look?


gp_usr replied 10 years ago

Yes, the syntax is different. All i am trying to do is for an existing Map change the script language to c# from vb and then in the line mapping, under Restrictions , i did a clear which changes the default script from (return true) to (return true;). I dont have any other scripts defined. There are some global variables which define the source file path etc.(ex: \filepathxx)

The error is:
Error Count :60
unrecognized escape sequence Newline in Constant.

I even tried creating a new map with c# as default scripting language but it still gives me the error.

Thanks for your help!


gp_usr replied 10 years ago

When i take out the default values for global file path variables it works. So it was those filepaths that c# was not able to identify.

How do i define the filepaths based on smart connect environment.?

For example if env=dev, \xxdevxx
                     if env=ts1, \xxts1xx

How do i do this in SmartConnect?


Best Answer
gp_usr answered 10 years ago
I found a solution to the above.

Use to escape in c#. Then I used c# Environment.MachineName to identify the Environment in which code is been run.


If you would like to submit an answer or comment, please sign in to the eOne portal.