Concatenate 2 Column into 1 Column

Hi All,
as you can see, I have a value in column2 and column3 and column4 is empty,
How do I get combine all the value column2 and column3 to column4
but the format is: ATB-PTRF-(value column3)-(value column2)

image

Best Regards

Hi,

Can you try the following?

row("Column4")="ATB-PTRF-"+System.Text.RegularExpressions.Regex.Match(row("Column2").ToString,"[\d/]+").Value+"-"+row("Column3").ToString

Regards,

Hi @Anggara_Rahmadhani

  1. You can use a for loop to read the value of the two columns and concatenate them and set them as value for column 4 similar to how @Yoichi shows above.

    OR

  2. You can try the following approach without using a for loop : New column in a data table by concatenating two existing columns

Hi @Yoichi
Your workflow is working on me, but the tricky using workbook is date time in value existing format not as expected when create new excel.
what if I want output just using file existing?


Thanks,
Best Regards

Beginner can also use this logic of String Manupulation.

“ATB-PTRF-” + row(“column3”).ToString + “-” + split(row(“column2”).ToString," ")(0)

1 Like

Thanks

Hi @Anggara_Rahmadhani

Try this way

  1. Read the excel and store in dt1 [Please tick the preserve format in read range]

  2. use invoke code with dt1 as In/Out argument and write the following code

dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“column4”)= “ATB-PTRF”+row(“column2”).ToString+row(“column3”).ToString)

Then write the dt1 to the excel file.

Hi @Nived
Sorry, I never using invoke code before… can you help please create in .xaml

Thanks,
Best Regards

Hi @Rohan_Senapaty
I got some error using your workflow, do u know what kind of error this?


Thanks,
Best Regards

recheck the column name. That should similar as in your sheet.

@Anggara_Rahmadhani

Check as below as per @NIVED_NAMBIAR suggestion
Process.zip|attachment
(54.1 KB)

Hope this may help you

Thanks

1 Like

Hi,

Can you try Preserve Format option of Read Range Activity? (However, it’s very slow)

Or the following expression might work.

row("Column4")="ATB-PTRF-"+DateTime.FromOADate(Double.Parse(row("Column2").ToString)).ToString("M/d/yyyy")+"-"+row("Column3").ToString

Regards,

Hi @Yoichi
im using your pattern expression, but I got some error… not in a correct format


Thanks,
Best Regards

Hi,

Can you share your data as a file? It’s no problem even if dummy data.

Regards,

Hi @Yoichi
As you request im attach my dummy data,
I want to concatenate in column Description: ATB-PTRF-(value column No. Receipt)-(value column Trans Date)
but the format date is ddMMyy

Dummy.xlsx (9.3 KB)

Thanks,
Best Regards

Hi @Anggara_Rahmadhani

Did u tried the invoke code method?

Hi @NIVED_NAMBIAR
Thank you for the insight,
Ya I did, trying using invoke code… I’m prefer using for each row, Sir.
but I got some issue with a convert date time, this has already been explained in a previous post

Thanks,
Best Regards.

1 Like

Hi @Anggara_Rahmadhani

Please find the below screen shots. Try this and let me know whether it meets your expectation.

Feel free to reach us at any time if you have doubts. Thanks.

Happy Automation

Hi @vignesh.ks
Thanks for your reply,
I’m happy that your workflow is very simple and this is my expectation, because I just using a file existing

Thanks,
Best Regards

1 Like

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