Android Question Problem with SQL

parijs

Active Member
Licensed User
Longtime User
I have the following code to put cities in a menu, there are multiple Nulls in the row that I need to exclude.
But because "i" also counts when a Null passes by, my Sender is no longer correct.
How can I solve this?
see picture


B4X:
        SQl.Initialize(File.DirRootExternal, Main.dato, False)
        intCount = SQl.ExecQuerySingleResult("SELECT COUNT(*) FROM museum WHERE city IS NOT NULL")
        Log(intCount)
        Dim curr As Cursor
        curr = SQl.ExecQuery("SELECT city, naam FROM museum ORDER BY city <> Null Asc")

        For i = 0 To intCount -1
            curr.Position = i
            naam = curr.GetString("city")

            If naam <> Null Then           
                bm(i) = naam
                Log(i)
                Log(bm(i))
''''                Dim content As String = $""$
''''                CLV1.Add(CreateItem(CLV1.AsView.Width, naam, naam, content), "")
            End If
    Next
 

Attachments

  • b4a.jpg
    b4a.jpg
    29.2 KB · Views: 53

parijs

Active Member
Licensed User
Longtime User
I can not see any Nulls in your Screenshot!?
That's right DonManfred but you can see it jump from 5 to 7 and from 16 to 37 in between are the Null. Delft is at number 8 in the menu but now gets number 9 so when I press delft I don't get to the right place
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Delft is at number 8 in the menu but now gets number 9 so when I press delft I don't get to the right place
you can hold a map with the menuentries and check the rigth id from your map. maybe store the ID from Delft as the Key and Delft itself as the name.
 
Upvote 0

emexes

Expert
Licensed User
This looks promising, if SQLite supports it:


Syntax:
SELECT column_names
  FROM table_name
 WHERE column_name IS NOT NULL;

Example Query:
SELECT * FROM Student
WHERE Name IS NOT NULL
AND Department IS NOT NULL
AND Roll_No IS NOT NULL;
 
Upvote 0
Top