cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Searching Characters in a content of XML

Former Member
0 Likes
288

<p>Hi all,</p>

   <p>Is it possible to get how manu characters in a content in xml? i.e., Example : In the following line " SAP Manufacturing Integration and Intelligence ", to get the

number of occurences of letter "i". Output should be: Number of occurences of letter "i" = 5.

  I need it from XML content like,

<item>

  <LINE>008:00000010,005:James,004:Bond,008:00000000,000:,001:0,022:0 - No time evaluation,010:01.01.2002,001:0;008:00000010,005:James,004:Bond,008:50001357,025:00 Sales Bord Computer UK,001:0,022:0 - No time evaluation,010:01.01.2002,001:0;008:00000069,007:Horatio,006:Holder,008:00000000,000:,001:0,022:0 - No time evaluation,010:01.01.2003,001:0;

  </LINE>

</item>

to get the number of ";" from the above XML. Output: Number of ";"= 3. Pls say as soon as possible.</p>

Thanks.</p>

Accepted Solutions (1)

Accepted Solutions (1)

aravinth_anandhan
Active Participant
0 Likes

Hi Chandra sekar,

You can also use SQL query for your requirement. For that you need to create a SQL query with following query details

Select len('[Param.1]') - len(replace('[Param.1]', '[Param.2]', ''))  as output

Here, Param.1 will have your string value and Param.2 will have delimiter ";"

After creating SQL query, in your transaction, select SQL query action block and map Param.1 and Param.2.

Now in query output, you will get number of occurrence of your delimiter in a string.

Regards,

Aravinth

Answers (1)

Answers (1)

jcgood25
Active Contributor
0 Likes

Use String List to XML with ; as your delimiter.  Then use xpath to count the items and subtract one.  If you have any reason to repeat on the items the Repeater action also provide the count.

HariCS23
Contributor
0 Likes

Chandra, Use expression count(/Rowsets/Rowset/Row)  if you are not sure of syntax.

Thanks

Hari