Splitting string contained in a data table

I am trying to extract data for Event, Time, and Points from a college swimming database. I scraped the table just like normal and got the result I wanted except the scrape is yielding unwanted text

tableScreenCap

I don’t want the Event column to include the meet at which the event was swam (the second line). I tried to scrape the table differently so that it won’t include the meet name but it’s still yielding it even when i specifically drag the event name only.

Once the table is scraped its exported to a data table (duh) in the format I would like except the Event column has the unwanted text. I’m trying to remove that text. I’ve looked around at splitting the string by Environment.NewLine and whatever other advice is out there but it isn’t working.

I’m wondering if splitting a string inside a data table requires different syntax but all I could think to do was add a .ToString to the end.

What I’ve tried

  • Assign row(“Event”) = row(“Event”).ToString.Split(Environment.NewLine.ToArray, stringsplitoptions.RemoveEmptyEntries)

  • I’ve also tried the same thing, but with the vbCr delimiter in the NewLine’s place.

If you could help a rookie out I would really appreciate it

Hi @Kriptiko

Welcome to the Community!

Please try

Split(Environment.NewLine.ToCharArray, StringSplitOptions.None)(0)

Let me know how it goes

@goodoldme would I type <row(“Event”).ToString> before I put that in?

That’s right, @Kriptiko. I’m assuming you’re looping through the DataTable using a For Each Row activity.

Assign row("Event") = row("Event").ToString.Split(Environment.NewLine.ToCharArray, StringSplitOptions.None)(0)

Here’s a sample. I have used an excel for the input data.

Test.xaml (6.6 KB) Events.xlsx (8.7 KB)

1 Like

@goodoldme I am in fact using a for each row Thank you for your input, I’m going to try and implement it real quick

1 Like

It worked! I’m now getting the text I want. Thank you for your help @goodoldme

Hi @Kriptiko

I’m glad you found a solution to your problem. If you could kindly mark the appropriate response as the solution to close this question and help people in the future.

Thanks

1 Like

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