When reading a table from a clipboard / how to avoid reading the column header

Hello, I have a table from an application which i am reading. I cannot use any screen scraping methods.
Let’s say you have a column that looks like the column below (City is the header):

City
Miami
Tokyo
Lagos
Paris

After copying this column to the clipboard I output it with the name string_Variable

If i use the below code, the first item is City but I want the 1st item to be Miami
item = split(string_Variable,Environment.NewLine)

What addition do i need to make to the code to get Miami as the 1st item?

Regards

item = split(string_Variable,Environment.NewLine)(1) will return miami

if u are iterating, skip the zero(0) index. it will start from miami then.

1 Like

ok thanks @kadiravan_kalidoss go if i understand you correctly i don’t need a variable for the index

for instance

for each item in split(string_Variable,Environment.NewLine)(1)

It would just iterate from that point on. great thanks

  1. split(string_Variable,Environment.NewLine).toarray
  2. For Each activity - create index variable in properties
  3. Inside body
    if (index>0)
    {
    your action
    }

it will skip the first index(0).

look into the properties of the read action. if possible, check “colom names”, this way it interprets the first row as description. you won’t need to skip the row and can shorten the processing time.

hi @kadiravan_kalidoss

this actually just gets each character out of the first line. for instance instead of getting Miami as a whole for each iteration, you get a letter -> M
-> i
-> a
-> m
-> i

Print the string variable and check how it is appearing…

Whether column names are in line by line or not.

@kadiravan_kalidoss so for the index variable that you mentioned? how would it look like?

index = string_Variable.indexOf() ??

In for each activity, check in properties panel. Index field will be there, please declare a int32 variable there.

Hello @alejohnson
There is an simple way of doing instead of iterating you can use Skip Method

in the above code make this change

Item=split(string_Variable,Environment.NewLine).skip(1).toarray

it’ll skip the first value in our case city and hence the first item would be Miami
Just make sure item variable is an Array of String Datatype

check this workflow for better understanding

Skip.xaml (5.4 KB)

1 Like

@vickydas
just curious …why wouldn’t it be skip(0) ?

Also i just tried it with the skip(1) and it still gives me the header.

Hello @alejohnson
the number inside skip method is used to specify the number of elements we have to skip and not its index or position.
So as in your case we have to skip the first element so we use Skip(1) instead of.

you used skip after splitting the data to an array variable right ?
did you follow the exact step as i told you?

Check this workflow to understand more clearly here i took text from clipboard Split it using new line and used the skip method

Main.xaml (5.8 KB)

@vickydas this is how my code looks in a for each:

for each item in split(string_Variable,Environment.NewLine).skip(1).toarray
.
.
.
code continues…

I have log messages in the code just to see what the 1st items will be and it still showing me the column headers. I’ll take a look at your attachment you just added.

Hello @alejohnson

try this assign the above code to an ArrayOfString Datatype variable and then use that variable and in for each.

Also check my above workflow to understand more clearly

hello @vickydas
I actually think it did skip the first row. I was just reading the data wrong. Thanks :slight_smile: