File Mover Blog

September 1, 2024

Count the number of occurrences of an xml field

Q: We would like to count the number of occurrences of point X in a xml file and update the file name with that value. Kindly refer the code and validate with sample file attached . Let us know if any details required from us.

  • Input file Name: 12345678.3959-2024.04.25-08.20.30-WIT-signed.xml
  • Generated Output file Name : 12345678.3959-2024.04.25-08.20.30-WIT-signed.79.xml

Content example xml file:

limagito file mover C:\Users\coene\Downloads\Count the number of occurrences\count the number of occurrences

A: Please have a look at the following screenshots:

  • We added the floowing WIN as Source:

limagito file mover windows folder as source

  • Please open our Pascal Script option:

limagito file mover pascal script option

  • Enable and Add the following On Destination Pascal Script:

Link to Script, we are using the psVIA (Pascal Script Variable Integer A, = %VIA parameter):

limagito file mover count the number of occurrences

  • Destination Setup, we added an Windows Folder as Destination:

limagito file mover destination setup

  • Destination File Rename Setup:

limagito file mover file rename setup

As replacement parameter we’ll use the value of %VIA (= psVIA which we obtained previously in our Pascal Script):

RegEx: (.*)\.(.*)
Replacement:  \1.%VIA.\2
limagito file mover file renaming setup
– RunTime Log Result:
limagito file mover runtime log result

If you need any help with this ‘count the number of occurrences of a xml field’ request, please let us know.

Best Regards,

Limagito Team

#xml #managedfiletransfer #filetransfer #filemanagement

By Limagito-Team Pascal Script XML , Share:
SEARCH