Check if table cell has data

noclass1980

Active Member
Licensed User
Longtime User
Hi,

I have a table that is loaded with a csv file. I want to loop through each column on a particular row and check if the cell has data (string or number) or not and count the number of instances where there is data (like the COUNTIF function in excel). However, the data can be either string and numbers so my code below fails when a cell contains a string because CellCheck is "dimed" as Int. I get the following error message

Return values(Col)
java.long.NumberFormatException:Invalid double:"S"


The "S" is the string that is in the cell when it fails.

I wonder if there is a Boolean test that looks at a cell and return True if there is something in the cell and False if empty. I want to use this information later so I need to be able to count the data cells progammatically.
Any suggestions? Thanks

B4X:
Dim CellCheck As Int
Dim CellFull As Int:CellFull=0
Row = 3
For i=2 To 13
  CellCheck= SWOTTable.GetValue(i,Row)
  Log(CellCheck)
  If CellCheck>=0 Then 
      CellFull=CellFull+1
  End If
Next
 If CellFull>3 Then 
   ToastMessageShow("There are " & CellCheck & " cells with data in Row " & Row)
End If
 
Last edited:

noclass1980

Active Member
Licensed User
Longtime User
Problem solved


Perfect, thank you!
:sign0060:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…