cancel
Showing results for 
Search instead for 
Did you mean: 

[Agentry] How to handle "{" in generating string with Rule editor

Former Member
0 Kudos

hi Gurus,

I tried to use the rule editor to generate a string "{ .... }".

An illustrative example is shown below. However, it seems that the "{" causes some trouble here. The generated string is always "{}"

If the first sub-string is "{example", then the generated string is "{example}. It looks like if the sub-string contains "{", the concatenation stops right there and with an auto-filled "}".

If I replace the "{" and "}" with "[" and "]", the generated string is fine. Note that "{" is not considered as a special string in the string related function.

Is it a known bug? Otherwise, how can I generated a string with "{" and "}"?

The Agentry version is 6.0.44.

Thanks.

-Yang

Message was edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If the line has a { it also needs to have a } in the same line.  What you can do it like

{ /* } */

This will have the second one commented out, but the line does have the both open and close.

Stephen

Former Member
0 Kudos

Stephen,

Thanks for the reply and explanation.

Is "{" the only special character in rule editor or there is a list of characters need special handling?

And for discussion purpose, if I do want to input a string like " {/*}*/ ", how should I format it in the rule editor?

-Yang

Former Member
0 Kudos

Yang,

Is "{" the only special character in rule editor or there is a list of characters need special handling?

That is the only one I know of.

And for discussion purpose, if I do want to input a string like " {/*}*/ ", how should I format it in the rule editor?

Just like that:, but I was say add a space between the { and / for readability:  { /*}*/ 


Stephen

Former Member
0 Kudos

Stephen,

Let me show you an example.

If we want to generate two strings, one is "{50%}", the other is "{/*}*/50%}",

For the first one, is the following right given the format-decimal returns 50?

how about the 2nd string?

Thx.

-Yang

Former Member
0 Kudos

I don't understand your question.

Do you mean what should I do about the line with "%}" on it?  Then it should be:

%/*{*/}

Former Member
0 Kudos

Stephen,

With the following rule,

The generated string is "{ /* } */ xx% /* { */ }"

Although the problem with a single "{" is not there, but the string is not what I want. I want to have

"{40%}". I don't want to have "/* } */" in the final generated string. It cannot be interpreted as comment in our situation.

Thx.

-Yang

jason_latko
Active Contributor
0 Kudos

Yang,

If the braces are giving the rule editor a problem, then don't use them as constants in the rule.  Create string globals that hold the braces: global.openbrace, global.closebrace.  Then refer to the globals in your rule as parameters to the CONCATENATE:

CONCATENATE

     global.openbrace

     PROD logic block

     global.endbrace

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Jason,

That's a smart way. Never thought about this!

-Yang

Former Member
0 Kudos

Stephen,

I got it by more experiment on my side.

Using /* */ can only help to prevent the auto complete of {}. We have to use the specific "comment" format which can be understood in the place where the string is generated.

The commented part is discarded by the interpreter of the string instead of by the rule editor.

Thx.

-Yang

Answers (1)

Answers (1)

0 Kudos

Moved to SAP for Mobile.  Not SMP related, application development question.

Regards, Mike (Moderator)