Get string in the middle of a string

0
Hi All, Is there a way to get a specific string that is located in the middle of a fairly long string? For example, I have the below string which is coming from the Content attribute of the $latestHttpResponse variable : <d:Message>ABC123</d:Message></m:properties></content></entry> And I just want to get the string that is bolded. Taking into consideration that the bolded message can always change depending on the response I get from an API Call.  Some context on how the API call works is we are making an API POST call to SAP and even though it returns a successful response code like 201 Created, there is a possibility that there is an error somewhere and its only shown in the Content attribute of the $latestHttpResponse variable. And should that error occur, the error message needs to be shown to the app users. I can’t seem to get my head around it by just using substrings. I am using Mendix 8.18.4. Any assistance would be greatly appreciated. Thank you. Best Regards Kevin
asked
2 answers
0

it seems like a response which is in XML format, try to use import mapping that will help you 

answered
0

Hi Kevin,

Using Find method you can get the index of first > using the same you can get / index postion

now you have to do is

substring(‘<d:Message>ABC123</d:Message></m:properties></content></entry>’, find(‘>’)+1, find(‘/’)-2)

so you can get ABC123

 

 

 

answered