cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Script require to read data from brackets

KaladharNukatho
Explorer
0 Kudos

Hi,

I need your help on groovy script to read the data which is present only brackets and remaining text ignore for the positionCode which comes in output JSON file attached for your ref..

positionCode":"Senior Consultant - HCM (50001234) ---required output is “positionCode”: 50001234

View Entire Topic
KaladharNukatho
Explorer
0 Kudos

hi,

thank you for your response. when i tried with groovy script in mapping as below - its not working.

import com.sap.it.api.mapping.*

def String exampleSingleValue(String s, MappingContext context) {

//Your code here

String s = 'positionCode":"Senior Consultant - HCM (50001234)'

tempString = s.substring(s.indexOf("(") + 1);

resultString = tempString.substring(0, tempString.indexOf(")"));

return result;

}