Any and all ideas are certainly appreciated!
I define a type and a list in Sub Globals
Later in the code the user can define and enter the values for a new drug, which adds them to the list file:
That seems to work well. On the next run of the app, the file "saveddrugs.lst" is read and a list of previously saved drugs is populated, HOWEVER the MyDrugs type has been split into several entries instead of one per line!
log:
** Activity (main) Create, isFirst = true **
0, [AdminMeasure=0, Amount=1, DrugName=DRUG1
1, , IsInitialized=true, Measure=0, Volume=1
2, ]
Which is causing all kinds of errors. I've checked the DrugName variable to certify there are no CrLF characters, and even renamed it to AAADrugname, which places it first in the list.
Every time I store the list, only three items make it into the first line, three into the second, etc. instead of each MyDrugs type occupying a single line.
Is this normal behavior for the List type?
I define a type and a list in Sub Globals
B4X:
Type MyDrugs(DrugName As String, Amount As Int, Measure As Int, Volume As Int, AdminMeasure As Int)
Dim SavedDrugs As List
Later in the code the user can define and enter the values for a new drug, which adds them to the list file:
B4X:
Dim thisdrug As MyDrugs
thisdrug.Initialize
thisdrug.DrugName = ID.Input
thisdrug.Amount = edtDrugAmt.Text
thisdrug.Measure = spnDrugAmt.SelectedIndex
thisdrug.Volume = edtVolSol.Text
thisdrug.AdminMeasure = spnDoseOrd.SelectedIndex
SavedDrugs.Add(thisdrug)
File.WriteList(File.DirInternal, "saveddrugs.lst", SavedDrugs)
That seems to work well. On the next run of the app, the file "saveddrugs.lst" is read and a list of previously saved drugs is populated, HOWEVER the MyDrugs type has been split into several entries instead of one per line!
B4X:
<activity create>
SavedDrugs.Initialize
If File.Exists(File.DirInternal,"saveddrugs.lst") Then
SavedDrugs = File.ReadList(File.DirInternal,"saveddrugs.lst")
For i = 0 To SavedDrugs.Size-1
Log(i & ", " & SavedDrugs.Get(i))
Next
log:
** Activity (main) Create, isFirst = true **
0, [AdminMeasure=0, Amount=1, DrugName=DRUG1
1, , IsInitialized=true, Measure=0, Volume=1
2, ]
Which is causing all kinds of errors. I've checked the DrugName variable to certify there are no CrLF characters, and even renamed it to AAADrugname, which places it first in the list.
Every time I store the list, only three items make it into the first line, three into the second, etc. instead of each MyDrugs type occupying a single line.
Is this normal behavior for the List type?