Sub Process_Globals
Type paese (Stato As String, Capitale As String)
Dim numerocoppie As Int
Dim paesescelto As Int
Dim PaeseperDomanda As String
End Sub
Sub AppStart (Args() As String)
'storing a list from a file
Dim su As StringUtils
Dim headers As List
headers.Initialize
Dim data As List = su.LoadCSV2(File.DirAssets, "StatieCapitali.CSV",",",headers)
'add items to the list paesi that include two fields Stato and Capitale
Dim paesi As List
paesi.Initialize
For Each row () As String In data
Dim p As paese
p.Initialize
p.Stato = row (0)
Log($"***********************"$)
Log(p.Stato) 'I am using this only for my learning purpose and see if it reads each State
p.Capitale = row(1)
Log(p.Capitale) ' same as above comment
paesi.Add(p)
Next
' other useful commands for Lists: sort in asc/desc order the list
' paesi.SortType("Stato", True)
' paesi.SortType("Capitale",False)
numerocoppie = paesi.Size 'collect the information on how big is the List
Log($"***********************"$)
Log($"Nella lista ci sono ${numerocoppie} coppie"$)
'???how to extract a single value???
paesescelto = Rnd(0,numerocoppie) 'choose a random position to be used later
PaeseperDomanda = paesi.Get(paesescelto)
Log($"*********************"$)
Log(PaeseperDomanda)
'for exemple IT PRINTS: [IsInitialized=true, Stato=Finlandia, Capitale=Helsinki]
'HOW CAN I EXTRACT only the Stato=value ??? in this case Finlandia....
End Sub