I load the following csv file:
"Skill Name","Total","Mod","Key","Ranks","Class","CC","Trained","SP","Misc","Synergy","TCP"
"Left","Center","Center","Center","Center","Center","Center","Center","Center","Center","Center","Center"
"Appraise",6,3,"Int",0,,true,false,0,3,0,0
"Balance",-1,2,"Dex",0,,true,false,0,0,0,-3
"Bluff",1,1,"Cha",0,,true,false,0,0,0,0
"Climb (with climb kit)",2,2,"Str",1,"F,A",false,false,1,2,0,-3
Then convert it to a list of maps with this code:
I want to convert the list of maps back to the original csv file format and save it. I have been trying for hours to get that done with no success. How can I do this?
Thanks again for assistance!
"Skill Name","Total","Mod","Key","Ranks","Class","CC","Trained","SP","Misc","Synergy","TCP"
"Left","Center","Center","Center","Center","Center","Center","Center","Center","Center","Center","Center"
"Appraise",6,3,"Int",0,,true,false,0,3,0,0
"Balance",-1,2,"Dex",0,,true,false,0,0,0,-3
"Bluff",1,1,"Cha",0,,true,false,0,0,0,0
"Climb (with climb kit)",2,2,"Str",1,"F,A",false,false,1,2,0,-3
Then convert it to a list of maps with this code:
B4X:
Sub LoadCSVFromFile(FileDir As String, FileName As String, ListOfMaps As List, HeaderList As List, Justification As Map)
Dim ListFromFile As List
Dim ReturnMap As Map : ReturnMap.Initialize()
Dim cells() As String
Dim su As StringUtils
'Load Skill List from file
ListFromFile.Initialize
ListFromFile = su.LoadCSV2(FileDir, FileName, ",", HeaderList)
Log("ListFromFile = " & ListFromFile)
'Populate Justification Map from 1st row in ListFromFile. Note that the header row is not counted because the HeaderList took that from the count.
Justification.Initialize()
cells = ListFromFile.Get(0)
For j = 0 To HeaderList.Size -1
Justification.Put(HeaderList.Get(j), cells(j))
Next
'Populate List of Maps (one map for each skill, spell, etc.)
For i = 1 To ListFromFile.Size - 1
cells = ListFromFile.Get(i)
Dim ItemMap As Map
ItemMap.Initialize()
For j = 0 To HeaderList.Size - 1
ItemMap.Put(HeaderList.Get(j), cells(j))
Next
ListOfMaps.Add(ItemMap)
Next
End Sub
I want to convert the list of maps back to the original csv file format and save it. I have been trying for hours to get that done with no success. How can I do this?
Thanks again for assistance!