Selecting entry from Data Table

Hello all, this is the data table I am having,


From the column name “Material”

  1. I wish to extract the value which starts from digit ‘5’.
  2. The value then extracted should exclude all preceeding 0’s from it

Regards,
Hardik Durgam.

Hi @Hardik_Durgam,

(from s in dt.AsEnumerable where s(“Material”).tostring.trimstart("0"c).Startswith(“5”) select s(“Material”).Tostring.TrimStart("0"c)).ToArray

This gives all required data in array of string.

Hope it helps.

Hey @Hardik_Durgam ,
You can try this,

Regards,

@Harshith_Adyanthaya will this give me value in string format?

It gives in Array of String format.

@Harshith_Adyanthaya ,
No According to @Harshith_Adyanthaya method it will be stored in an Array of string .
Put a for each loop for the array . there you will get the each items inside for each.

Regards,

@Harshith_Adyanthaya can you help me out by sending the code which gives output in string format?

String.Join(“,”, (from s in dt.AsEnumerable where s(“Material”).tostring.trimstart("0"c).Startswith(“5”) select s(“Material”).Tostring.TrimStart("0"c)).ToArray)

This will give all values in String. Comma seperated.

@Jithesh_R could you please share your workflow if possible?

@Hardik_Durgam ,
FilterDataTable03.zip (2.2 KB)
FilterDataTable03.xlsx (8.5 KB)

This workflow returns the values which starts with 5 Individually.
Let me know if this is not your required output

Regards,