iLogic Findrow IsNullOrEmpty

iLogic Findrow IsNullOrEmpty

kfc10
Participant Participant
620 Views
3 Replies
Message 1 of 4

iLogic Findrow IsNullOrEmpty

kfc10
Participant
Participant

HOW TO FIX THE ERROR? In the attachment I am sending 2 excel files and 1 part

''Example 1 = BAD - ERROR = HOW TO FIX THE ERROR?
id1 = "P"
id2 = 3
id3 = "S235"

filepath = ThisDoc.Path
location = filepath & "\" & "ExampleFind_Error.xlsx"
sheetuser = "Sheet1"
'MessageBox.Show(location, "Title")

i = GoExcel.FindRow(location, sheetuser, "aa", "=", id1, "bb", "=", id2, "cc", "=", id3)

MessageBox.Show(i, "Title")
MessageBox.Show(GoExcel.CellValue(location, sheetuser, "A" & i), "Title")

GoExcel.Close
InventorVb.DocumentUpdate()

2023-04-01_02h02_28.png

 

''Example 2 = OK
'id1 = "P"
'id2 = 3
'id3 = "S235"

'filepath = ThisDoc.Path
'location = filepath & "\" & "ExampleFind.xlsx"
'sheetuser = "Sheet1"
''MessageBox.Show(location, "Title")

'i = GoExcel.FindRow(location, sheetuser, "aa", "=", id1, "bb", "=", id2, "cc", "=", id3)

'MessageBox.Show(i, "Title")
'MessageBox.Show(GoExcel.CellValue(location, sheetuser, "A" & i), "Title")

'GoExcel.Close
'InventorVb.DocumentUpdate()

2023-04-01_02h02_05.png

0 Likes
621 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

A null value will give a row number of -1. You can then do another operation when  found by using an if statement. An alternative is to loop through cell values and find cells of no string

See ilogic methods here. 

 

For i =1 To 10
If GoExcel
.CellValue(location, sheetuser, "A" & i) = "" Then
MessageBox.Show("Column A has a Blank Cell at row " & i, "Blank Cell Check")
End If
Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 4

kfc10
Participant
Participant

I don't want to evaluate to 0 or empty. I want to skip it.
I need the result to be BINGO without errors. How can I make findrow not give me errors of empty cells or cells with the value 0 and only skip them and evaluate what I'm looking for? Is this even possible with ilogic?

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

Generally speaking your table of values shouldn't have blanks. You can fill the data  with a value such as N/A to allow the function find row to operate. The function is simple and can't work without clean data. See the return value for the function. If you can't get that to work you can work with excel dll directly where you will have access to all of excel capabilities but you have to code more as a result. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes