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):
After copying this column to the clipboard I output it with the name
If i use the below code, the first item is City but I want the 1st item to be
item = split(string_Variable,Environment.NewLine)
What addition do i need to make to the code to get Miami as the 1st item?
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.
@kadiravan_kalidoss go if i understand you correctly i don’t need a variable for the index
item in split(string_Variable,Environment.NewLine)(1)
It would just iterate from that point on. great thanks
split(string_Variable,Environment.NewLine).toarray For Each activity - create index variable in properties
it will skip the first index(0).
September 19, 2019, 2:15pm
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.
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
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.
September 20, 2019, 6:49am
There is an simple way of doing instead of iterating you can use Skip Method
in the above code make this change
it’ll skip the first value in our case city and hence the first item would be
Just make sure item variable is an Array of String Datatype
check this workflow for better understanding
Skip.xaml (5.4 KB)
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.
September 23, 2019, 5:09am
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:
item in split(string_Variable,Environment.NewLine).skip(1).toarray
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.
September 24, 2019, 4:51am
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
I actually think it did skip the first row. I was just reading the data wrong. Thanks