Hi all,
I’m testing input push data from CSV file into SAP. I want to check the next empty cell in any column ( Such as : A column )… If the next cell In A column is empty, then the program will stop and show message.
How to check this condition ?
Thanks you so much!
@rahatadi
rahatadi
(Aditya Rahatekar)
January 29, 2019, 6:40am
2
@trunghai
if i understand correctly, you want to check if there is any empty cell in given column ?
1 Like
You may have to use while loop for this.
dataTable.Rows(r).Item(c).ToString
r - row number, starting from zero
c - column number, starting from zero
1 Like
Hi @trunghai
You can read Whole column And using For each row you can iterate it. in the loop you can use If Activity and gives the condition in If “Row = Nothing” then perform the action action you want in then Section.
Thanks & Regards
2 Likes
@rahatadi
I want to check if the next cell in A column is empty, then the program will stop.
As below picture is A4. What is the best command in If Activity to check this condition ?
Thanks so much!
Hi @jitendra_123
I want to check the next cell empty… The command " Row = Nothing " to check all row right ?
rahatadi
(Aditya Rahatekar)
January 29, 2019, 7:01am
7
you do not need loop here,
if
dt.select(“So Tk = ‘’”).length > 0
@trunghai
I hope you got the Whole “A” column. after that you can iterate it in for each row. in the for each row use IF activity give the condition “Row = Nothing” it will work for you.
Thanks & Regards
rahatadi
(Aditya Rahatekar)
January 29, 2019, 7:04am
9
@trunghai
@Sripadraj
It would be easier to get it from Sheet1, before it’s split:
foreach (row in dt)
{
string lastCell = row(0).ToString().Split(","c).Last()
}
@ranjith
Probably you could, but I don’t think it’s worth the trouble.
It’s clearer to just use a normal loop.
That said:
row(col) is nothing or row(col).Equals("")
There’s a better way to test for null or empty:
String.IsNullOrEmpty(row(col))
Another thing is that or operator tests both sides, which means that if your second check invo…
this topic is somewhat relevant to this.
@rahatadi
Hi, I have met this error as below.
nimin
(nimzz)
January 29, 2019, 7:16am
11
Hi @trunghai ,
Please use the condition row(0).ToString ="" in if activity.
Warm regards,
Nimin
rahatadi
(Aditya Rahatekar)
January 29, 2019, 7:17am
12
@trunghai
some quick and dirty solution.
please check
find_empty.xaml (14.9 KB)
@nimin
Thanks you so much!
But which is activity to stop immediately program when it detect the next empty cell.
@rahatadi
Thanks you so much always
rahatadi
(Aditya Rahatekar)
January 29, 2019, 8:07am
15
@trunghai
with for each loop and checking next cell is empty
if empty it will write line and exits from loop.
find_empty.xaml (20.6 KB)
Let me know, if it requires modification
Regards,
Aditya
1 Like
nimin
(nimzz)
January 29, 2019, 8:19am
16
Hi @trunghai ,
If you want to exit the iteration whenever a cell in the first column is empty , You can add a break activity in the ‘then’ section.
Regards,
Nimin
1 Like