Get a filename part while mapping XML

Userlevel 1


I need to get a specific filename part value while mapping XML to the desired structure in the XMLMap connector. F. ex. I need to extract ‘1234’ part from a file name 1234_abcd.xml.

I have tried to write an expression in the Expression Editor: [getfilename(substring(0, indexof(filename(), "_")))]

It does not work and I am not sure that is wrong.

Any ideas? Maybe there are even better solutions?


Best answer by Charlie S 2 May 2023, 17:25

View original

2 replies

Userlevel 3

If you are looking to get the 1234 portion of that filename, you can use the split formatter ( to split on the underscore character in the filename and return the first substring that resulted from the split.

Like this:

[filename | split(‘_’1)]

This expression would resolve to the value of “1234”.

Does this work for you?

Userlevel 1

Yes, thank you for your help!