cancel
Showing results for 
Search instead for 
Did you mean: 

use Regex expression in Attributes-from-sap.xml

DM-kiko
Explorer
0 Kudos
472

Hi,

Do you know where to find how to use regex expressions in the attributes-to-sap.xml or attributes-from-sap.xml? I want certain values which has decimal numbers to be converted to whole numbers.

If anyone could help me get started I would appreciate!

Regards, Danny

Accepted Solutions (0)

Answers (2)

Answers (2)

Hello Danny,

you have to use <REPLACE> tag for it.

take a look into operations guide, chapter 4 ATTRIBUTE TRANSFER BETWEEN THE SAP SYSTEM AND AN APPLICATION (or just search for string <REPLACE> in the document)

there are some examples too.

pattern should be a regexp which is supported by java RE (which is using PCRE syntax)

you can test your regexp using https://regex101.com/ (choose PCRE under "FLAVOR")

With kind regards,

Waldemar

DM-kiko
Explorer
0 Kudos

Hi Waldemar,

tried it with this:

I want to eliminate all decimal places in the values

<REPLACE pattern="^\d*" global="false"> <br>        <DIR_CLS ..../>
</REPLACE>

But it did not work, any other thoughts

0 Kudos

can you please post an example "input" string and what you exactly expecting as a result, then i can try to "compose" a regex for it.

this example will make 3 from 3.14

<REPLACE pattern="\+?([-]?\d*).*" global="false" replacement="$1">
...
</REPLACE>