Database and List/Array drives me crazy..

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

I'm sure, that there is a simple solution, but im really stuck at the moment...

Im using a SQLLite DB, which works really fine.

I have this structure:
Table 1:
ID | NAME | Positions

Table 2:
ID | Name

The values in Table 2 shall be inserted via Code lateron in the results from Table 1...

So if I have the entrys in Table 2:
1 | Home
2 | Work
3 | School

And this entry in Table 1:

1 | Test | 1, 2

It should be read in a List which consists of Types and the value 1 and 2 should be acessible..

Thank you!
 

barx

Well-Known Member
Licensed User
Longtime User
I don't get the question:sign0163:
 
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

Sorry, it's not easy, english is not my motherlanguage :)

Simplified:
I have a table in the database which consists of ID and Name - Pairs, for example:
B4X:
ID | NAME
1  |  Home
2  | Work
3  | School

And i have a 2nd Table with a field "Location". In that field the ID of the location should be saved. So if there is a "1" in that field, the app should replace that later with "Home". So far, this is no Problem at all. But: I would like to store up to n IDs in that field, So maybe "1" and "3". And then they should be replaced by "Home", "School".

I tried now to achieve that this way:
Store the IDs as String in the Location-Field: "1, 2". Then I use regex to divide the entrys and load them in a list. But I'm not sure, if that is the best way...

Best regards!
 
Upvote 0

giovit

Member
Licensed User
Longtime User
I think you must define 2 tables this way:
Locations table:
ID|LOCATION

Locations Group table:
ID|GROUP| LOCATION

then make a query for a specific GROUP and save the LOCATION field to an array or LIST

in other words replace regex for a query
 
Upvote 0
Top