B4J Question List with Multiple fields

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am trying to create a list but have multiple columns.

I tried using a map (I might of done it wrong) but can't work out how to use multiple columns.

I need to have the following fields in a list..
AccountID
Field1
Field2
Field3

I want AccountID to be unique. So if the value of AccountID is already added in the list then it should not add the item to the list again.

I need to be able to select Field1, Field2 & Field3 based on the accountID value.

Any ideas on what I need to do to create a list based on the fields above ?
 

aaronk

Well-Known Member
Licensed User
Longtime User
Are you able to give me a example ?

I tried using the map but I could only work out how to add a key and only 1 value for that key.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Type MyDataType (AccountId As String, Field1 As String, Field2 As Int, Field3 As Double)

B4X:
Sub AddItemToMap(AccountId As String, Field1 As String, Field2 As Int, Field3 As Double)
dim mt As MyDataType
mt.Initialize
mt.AccountId = AccountId
mt.Field1 = Field1
...
map.Put(AccountId, mt)
End Sub

B4X:
Dim mt As MyDataType = map.Get("Some Id")
 
Upvote 0
Top