How to split a value after some places in excel row

Hi all,

I have some values that are looped through for each and now I want to split the value in order to perform a type into activity but I’m getting an error.

The value is like: V2527466300200:D8518 and I need to get the split value as V25274663002 so that I can type into it to some desired field.

Please let me know how to do that! If there is specific code to assign to a split function then please let me know.

Thanks in advance…

@vishnu_prasad21
Split using “:” as delimiter

Yah it can be done like this
—once after getting the datatable from excel with read range activity with a variable named dt
Use a FOR EACH ROW activity and pass the variable dt as w
—inside the loop use a assign activity like this
str_input = IF(row(“yourcolumnname”).ToString.Contains(“:”),Solit(row(“yourcolumnname”).ToString,”:”)(0).ToString,row(“yourcolumnname”).ToString)

The we can pass this str_input as input to TYPE INTO activity
Cheers @vishnu_prasad21

1 Like

Thank you for the code. It worked but I need to get the output as V25274663002… It should also remove the last two zeros from the string

While running the code I got V2527466300200 but the desired output is V25274663002.

Please let me know the code for this…??

Thank you.

1 Like

Hi @vishnu_prasad21

use assign in_String = “V2527466300200:D8518”
out_String = in_String.Split(":"c)(0)
you will get output is V2527466300200.
and then use out_String variable where you want.

image

Regards,
Kommi Jeevan.

Fine
In that case the expression be like this
str_input = IF(row(“yourcolumnname”).ToString.Contains(“:”),Solit(row(“yourcolumnname”).ToString,”:”)(0).ToString,row(“yourcolumnname”).ToString).ToString.TrimEnd(“00”)

Cheers @vishnu_prasad21

Thank you for the resolution but I need to get the output as V25274663002 how to get that.?

@vishnu_prasad21

use assign in_String = “V2527466300200:D8518”
out_String = in_String.Split(":"c)(0)

But I’m getting a compiling error

How to resolve that. Thank you.

1 Like

Still I’m getting V2527466300200 while using var. Split(“:” C) (0)

Thank you.

Here you go

str_input = IF(row(“yourcolumnname”).ToString.Contains(“:”),Split(row(“yourcolumnname”).ToString,”:”)(0).ToString.Substring(0,Split(row(“yourcolumnname”).ToString,”:”)(0).ToString.Length-2),row(“yourcolumnname”).ToString)

Or

str_input = IF(row(“yourcolumnname”).ToString.Contains(“:”),Split(row(“yourcolumnname”).ToString,”:”)(0).ToString.Trimend(“00”),row(“yourcolumnname”).ToString)

Cheers @vishnu_prasad21

1 Like

Kindly try this and let know for any queries or clarification
Cheers @vishnu_prasad21

Thank you @Palaniyappan the first code works just fine the output is correct. The second code has some compiling issue. But it worked with the first code.

Thank you for the help @Palaniyappan.

1 Like

I hope Substring method would work upon the second requirement

Cheers @vishnu_prasad21

1 Like

@vishnu_prasad21

For above method Instead of Trimend(“00”) use Trimend({"0"C,"0"C}). Method will work.

str_input = IF(row(“yourcolumnname”).ToString.Contains(“:”),Split(row(“yourcolumnname”).ToString,”:”)(0).ToString.Trimend({"0"C,"0"C}),row(“yourcolumnname”).ToString)

1 Like

Simple Solution using Regex:
System.Text.RegularExpressions.Regex.Match(VAR_NAME,“\w{12}”).Value

:smiley:

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