Split" names" from a collected data table

hello Developers

I’m hoping someone can assist me with this inquiry. I have built a DT that contains Employee Names. I need to “add data row”. The array I have input has multiple objects, but I need to “Split” the names as Last name first, First name last. Please note that some names can contain middle names on them.

The current output has first name last name. exp: John Luis Smith
I need output to read : Smith, John Luis

Does anyone know how I can accomplish this? Any assistance will be appreciated.

imageimage

imageimage

If the firstName, Middle & lastName are separated by space then you can split by space?

Yes the names are split with space

Then you can use .Split(" "c) method and store the results (basis the count) in their respective firstName , middleName and Last Name variables.

Can I use the Split(" "c) method in my current Array?

{SubjectLineDT(0)(“EMP NAME”).ToString, PDFContentDatatable(0)(“TA Number”).tostring, SubjectLineDT(0)(“TRANSID”).tostring, “”, “”, SubjectLineDT(0)(“GBL”).tostring, PDFContentDatatable(0)(“Inv Total Charges Amt”).tostring, “”, “”, Emailitem.DateAsDateTime.Date.ToString(“MM/dd/yy”)}

You will not be able to use it on your entire array.

You first have to retrieve the SubjectLineDT(0)(“EMP NAME”).ToString separately from your array and then split it.

Can you please elaborate your use case? what is the source of this array? do you want to add tis array to DT ?

This link can also help : Split sting and add it to array - #4 by william.coulson

I think you just answered my question. I was hoping I didn’t have to separate it, but from what I have read online and yourself. Separation might be the only solution. Thanks anyway.

Great! Happy automation. Please close the Query by marking the solution.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.