In a form, I can see how to select a record using the LOBA (LibreOffice BAsic) absolute
method, like this:
form.absolute(record#)
It causes the form to move to the given record.
But how is the best way to get a record# from something like a ...WHERE ID=x
search?
Here’s what I know so far:
-
The ROW_NUMBER() function, can be used like this:
SELECT ROW_NUMBER() FROM table WHERE ID=2
Unfortunately, my version of LO, the latest, 5.2.3.3, does not seem to support this HSQL function.
-
I imagine I could run a query of all ID’s, load the results into an array, search the array for the ID, and use array index+1 as the row number. But this seems slow, awkward, and ignores the index.
-
I’m looking for something like findFirst() in Access. I did find findFirst() in LOBA, but it appears to be for text searches.
For example, say you have a simple table of cities, with two fields, ID and City, and you have a simple form, which shows only the city and nothing else. Then using only Basic, how can I cause the form to display a given city if I know the city’s ID?