My table Grades has fields like Account, Name,Subject,Score,Grade
how can i insert data into my table from the datamap
how can i insert data into my table from the datamap
B4X:
Dim jsonString As String = $"[{"ACCOUNT":"05-05828","Name":"ALIONZI MARTIN","HISEP1":"82","HISEP3":"94","HISEP6":null,"HISP1GRADE":"D1","HISP3GRADE":"D1","HISP6GRADE":"","GEOEP1":"51","GEOEP2":"73","GEOEP3":"88","GEOP1GRADE":"C6","GEOP2GRADE":"C3","GEOP3GRADE":"D1","ENGEP1":null,"ENGEP2":null,"ENGEP3":null,"ENGP1GRADE":"","ENGP2GRADE":"","ENGP3GRADE":"","ECONEP1":"73","ECONEP2":"88","ECONP1GRADE":"D2","ECONP2GRADE":"D1","DIVEP1":null,"DIVEP2":null,"DIVEP3":null,"DIVEP4":null,"DIVP1GRADE":"","DIVP2GRADE":"","DIVP3GRADE":"","DIVP4GRADE":"","LUGSWAEP1":null,"LUGSWAEP2":null,"LUGSWAEP3":null,"LUGSWAP1GRADE":"","LUGSWAP2GRADE":"","LUGSWAP3GRADE":"","FINEARTEP1":null,"FINEARTEP2":null,"FINEARTEP3":null,"FINEARTEP4":null,"FINEARTEP5":null,"FINEARTEP6":null,"FINEARTP1GRADE":"","FINEARTP2GRADE":"","FINEARTP3GRADE":"","FINEARTP4GRADE":"","FINEARTP5GRADE":"","FINEARTP6GRADE":"","ENTEP1":null,"ENTEP2":null,"ENTP1GRADE":"","ENTP2GRADE":"","COMPEP1":null,"COMPEP2":null,"COMP1GRADE":"","COMP2GRADE":"","SMATHEP1":"72","SMATHEP2":"84","SMATHP1GRADE":"C3","SMATHP2GRADE":"D1","GPEP1":"35","GPGRADE":"P8","PHYEP1":null,"PHYEP2":null,"PHYEP3":null,"PHYP1GRADE":"","PHYP2GRADE":"","PHYP3GRADE":"","CHEMEP1":null,"CHEMEP2":null,"CHEMEP3":null,"CHEMP1GRADE":"","CHEMP2GRADE":"","CHEMP3GRADE":"","BIOEP1":null,"BIOEP2":null,"BIOEP3":null,"BIOP1GRADE":"","BIOP2GRADE":"","BIOP3GRADE":"","MATHEP1":null,"MATHEP2":null,"MATHP1GRADE":"","MATHP2GRADE":"","AGRIEP1":null,"AGRIEP2":null,"AGRIEP3":null,"AGRIP1GRADE":"","AGRIP2GRADE":"","AGRIP3GRADE":"","HISPoints":"A","GPPoints":"F","PhyPoints":"","MathsPoints":null,"BioPoints":"","ChemPoints":"","GeogPoints":"D","EconPoints":"A","LitPoints":"","IREPoints":"","LugPoints":"","artpoints":"","FoodPoints":"","TDPoints":"","GermanPoints":"","WoodPoints":"","ArabPoints":"","EnterprPoints":null,"SubMathPoints":"O","CompPOINTS":"F","PrinciplePoints":15,"SubsidiaryPoints":1,"TotalPoints":16}]"$
End Sub
Dim parser As JSONParser
parser.Initialize(jsonString)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim dataMap As Map
dataMap.Initialize
For i = 0 To colroot.Size-1
If (colroot.GetValueAt(i) <> Null) And (colroot.GetValueAt(i) <> "") Then
dataMap.Put(colroot.GetKeyAt(i),colroot.GetValueAt(i))
End If
Next
Next
Dim gen As JSONGenerator
gen.Initialize(dataMap)
Msgbox(gen.ToPrettyString(1),"dataMap")