cancel
Showing results for 
Search instead for 
Did you mean: 

How to get string between comma's

Former Member
0 Kudos

Hi All,

I am working on one transaction and output is  "Deepali,B1993,January".But,I want only "B1993" as output.

How can I get it by using functions in expression editor?

Please help me in this.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

if output format is always same then string function can be used to get the desired result.

ccombination of stringindexof, stringpart and stringlength can also give the desired result. Let me know if u need sample example

Former Member
0 Kudos

output format is always same in this case.Can you give one sample example?

Former Member
0 Kudos

Transaction.Sample : Deepali,B1993,January

stringpart(stringpart(Transaction.Sample,stringindexof(Transaction.Sample,",")+1,stringlength(Transaction.Sample)-stringindexof(Transaction.Sample,",")),1,stringindexof(stringpart(Transaction.Sample,stringindexof(Transaction.Sample,",")+1,stringlength(Transaction.Sample)-stringindexof(Transaction.Sample,",")),",")-1)

Answers (2)

Answers (2)

former_member185280
Active Contributor
0 Kudos

Deepali,


Depending on your version another option you can try is using the stringtolist function to put the values into a local list type property. You can then get values by index using syntax like Local.mylist{1} etc.

Regards,
Christian

p.s. please mark answers helpful or correct. It helps others find solutions to similar problems easier. 

saivellanki
Active Contributor
0 Kudos

Hi Deepali,

Not sure whether there is any expression editor function available. But, one way of doing it is,


  • Create a local variable 'sample'. (In the screenshot I named it as 'Name')
  • Assign output value - Deepali,B1993,January to sample variable.
  • Then use 'StringListToXML' action block which is present under XML functions.
  • In the incoming action, map sample variable to input of StringListToXML and use "," as delimiter.

         

  • Now using XPath - StringListToXML.Output{/Rowsets/Rowset/Row[2]/Item} you can get the value

         

     

   

Regards,

Sai Vellanki.