Writting a backslash (\) and any other special character

RiojaAlberto

New Member
Hi, everyone.

I've been now trying to write a backslash into a SAP text field, but Blue Prism throws the next message:

1520887370779.png

The actual text is: @5C\Qopen@

Is there a way to write this character aswell as manyu others that mey be considered as specials?

Plesase, let us know.

Thanks.
 

VJR

Well-Known Member
Hi RiojaAlberto,

Backslash '\' is used as an escape sequence character in most of the programming languages and systems.
The backslash tells the interpreter that the next coming character is going to have a special meaning and hence treat is accordingly. For eg; in C language, \n refers to a newline character and so on.

In your case Blue Prism is treating Q to be having some meaning when encountered as \Q.
In such cases you need to add another backslash preceding the '\' in the text as below.

@5C\\Qopen@

Try checking out and post back what happens.
 

RiojaAlberto

New Member
Hi RiojaAlberto,

Backslash '\' is used as an escape sequence character in most of the programming languages and systems.
The backslash tells the interpreter that the next coming character is going to have a special meaning and hence treat is accordingly. For eg; in C language, \n refers to a newline character and so on.

In your case Blue Prism is treating Q to be having some meaning when encountered as \Q.
In such cases you need to add another backslash preceding the '\' in the text as below.

@5C\\Qopen@

Try checking out and post back what happens.
Thank you for the answer.

I tried to write it as you said, however, it didn't work, now sending a differente message :/

1521046334301.png
 

VJR

Well-Known Member
Hi RiojaAlberto,

I've tried the escape sequence characters on another application and its working fine. I do not know the SAP system so I looked up with some web search. I found out the below things but I am not sure if they are correct in SAP.

-Strings in SAP are enclosed within @ @
-\Q stands for quick info.
- If you scroll to the very last of the below link it says that there must be a SPACE between the \Q and the next text
https://archive.sap.com/discussions/thread/707322

Perhaps it looks like something to make the correction in the syntax as per the SAP system.
 

RiojaAlberto

New Member
I tryed the forward slash... it doesn't find the content 'cause the backslash is the correct one.

However, the error comes from Blue Prism, not from SAP :/

I found how to avoid writting the string on SAP by searching another field that doesn't require that string, but I think someone may find this thread useful, so I'll keep ir open 'til we find a "solution" :)
 

VJR

Well-Known Member
Hi RiojaAlberto, didn't read anything about that in your post but I hope you have tried the above given solution of adding a SPACE after the \Q?

Also, can you share your findings as to what you meant by "how to avoid writting the string on SAP". Perhaps that could also help someone to come to a solution....or maybe even one step forward.
 

RiojaAlberto

New Member
Hi RiojaAlberto, didn't read anything about that in your post but I hope you have tried the above given solution of adding a SPACE after the \Q?

Also, can you share your findings as to what you meant by "how to avoid writting the string on SAP". Perhaps that could also help someone to come to a solution....or maybe even one step forward.

I tried the space after the \Q, and the error is still there. I tried to write it directly to SAP, and it worked, so the error comes form Blue Prism, not from SAP. However, I tried to write it into a HTML text field, and it worked; Blue Prism didn't throw an error saying that the 'Q' was an invalid escape character. So... I don't know why it throws the error :/

What I meant with "how to avoid writting the string on SAP" was that, due to the process I'm automating, I no longer need to write that string (for now, and I hope I don't need to anymore). I didn't find a "solution" to the "problem" u.u
 

VJR

Well-Known Member
Hi,

Good you found an alternative way of writing the string.

You mentioned "I tried to write it directly to SAP, and it worked"
"However, I tried to write it into a HTML text field, and it worked"


Is there a typo in it. So then where did it not work?

- A same error message is on the below thread. It is for a path but you can take a look at it.
http://www.rpaforum.net/threads/invalid-escape-character-b.543/

- I see that you mentioned that you have already tried the forward slash.
But did you try all possible combinations and variations of it.

Original string: @5C\Qopen@
@5C\\Qopen@
@5C/\Qopen@
@5C/Qopen@
@5C\/Qopen@


These may not work but at least will help in reaching closer to the solution based on the errors they give.

- Also how about trying to split the string in two different data items just to see if it works that way.
Data1: @5C\
Data2: Qopen@
Then in the Writer: [Data1] & [Data2]


- Another option would be to intentionally set the Input string as the opposite slash and then correct it using the Replace inside the Writer just while passing to the textbox

InputString data item: @5C/Qopen@
Writer: Replace([InputString],"/","\")
 

RiojaAlberto

New Member
Hi,

Good you found an alternative way of writing the string.

You mentioned "I tried to write it directly to SAP, and it worked"
"However, I tried to write it into a HTML text field, and it worked"


Is there a typo in it. So then where did it not work?

- A same error message is on the below thread. It is for a path but you can take a look at it.
http://www.rpaforum.net/threads/invalid-escape-character-b.543/

- I see that you mentioned that you have already tried the forward slash.
But did you try all possible combinations and variations of it.

Original string: @5C\Qopen@
@5C\\Qopen@
@5C/\Qopen@
@5C/Qopen@
@5C\/Qopen@


These may not work but at least will help in reaching closer to the solution based on the errors they give.

- Also how about trying to split the string in two different data items just to see if it works that way.
Data1: @5C\
Data2: Qopen@
Then in the Writer: [Data1] & [Data2]


- Another option would be to intentionally set the Input string as the opposite slash and then correct it using the Replace inside the Writer just while passing to the textbox

InputString data item: @5C/Qopen@
Writer: Replace([InputString],"/","\")

I tried some of the methods you told me, however it did not work.

Writting the frontslash changes the things that are meant to happen, so it is not useful for the process. (It's for a search, so the backslash is the correct character to use)

Trying to write the same string but with concatanation ends at the same problem.

So, if we try to write the same string with a different preparation, the problem will be the same. And changing the backslash for a frontslash changes the searching results.
 

VJR

Well-Known Member
Hi RiojaAlberto,

Even though you mention that the error is from Blue Prism but it is only appearing when interacting with an external application like SAP which has its own semantics.
The slashes in combination with backward and forward work perfectly fine with HTML elements like you said. Probably you can try interacting with a BP rep about the issue. If they have a solution they will provide it to you or else if they see its not working then will include a fix in their next upcoming upgrade :).
 

RiojaAlberto

New Member
Hi RiojaAlberto,

Even though you mention that the error is from Blue Prism but it is only appearing when interacting with an external application like SAP which has its own semantics.
The slashes in combination with backward and forward work perfectly fine with HTML elements like you said. Probably you can try interacting with a BP rep about the issue. If they have a solution they will provide it to you or else if they see its not working then will include a fix in their next upcoming upgrade :).
It makes sense to me. Thank you :)

I'll try interacting with a BP rep and hope things get better XD
 
  • Like
Reactions: VJR

RiojaAlberto

New Member
Situation solved:

One of my mates solved the problem by writting the string on a Data bloc, focused the text box, placed a Navigation stage with Global send key events to the application and, for the text parameter, used the Data.

With that, Blue Prism wrote the string without problems :)
 
  • Like
Reactions: VJR

BhavanaKalva

New Member
Hello,
To over come this issue with SAP , please use SAP scripting. Let me know, if you are interested in the solution. I can help you out.
 

mbailey

Member
Hello,
To over come this issue with SAP , please use SAP scripting. Let me know, if you are interested in the solution. I can help you out.
BahavanaKalva,

I have a similar issue in which manually entering a string with one or more embedded commas into an SAP text field works but making the entry with a Blue Prism Write stage produces the "Exception has been thrown by the target of an invocation" error. Enclosing the string in 'at' symbols produces a "String was not recognized as a valid DateTime" error. Except for the backslash escape character, no other characters produce errors. This is a text field but I verified that the Decimal Notation setting is correct just in case. Like RiojaAlberto, I can put the desired value into the clipboard, set focus to the field, and use Global Send Keys to paste the value but I would prefer a more streamlined approach. I have not used SAP scripting but I would be interested in knowing how to use it to solve this problem.
 
Top