Android Question passing parameters

Makumbi

Well-Known Member
Licensed User
B4X:
jt.Download("http://kccug.com/Generic_Handler_JSON/HandlerVBAlevelreportArchive.ashx?customerId=${Account.Text}&customerId2=${spnFirstName.SelectedItem}&customerId3=${Spinner1.SelectedItem}"$ )

Please help iam trying to pass these parameters but my code has remain in red color please help me out were could the problem be
 

MarkusR

Well-Known Member
Licensed User
Longtime User
you forgot the $ before "
there is a better example with key value pairs.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You should use Download2 and use Parametrized Queries.
 
Upvote 0

Makumbi

Well-Known Member
Licensed User
You should use Download2 and use Parametrized Queries.
any example with download2 because currently iam using this as my way to got any possible problems with it in future
B4X:
Dim SQLQry As String = "DELETE FROM Alevelreport"
    Starter.SQL1.ExecNonQuery(SQLQry)
    Dim jt As HttpJob
    jt.Initialize("", Me)
    jt.Download($"http://kccug.com/Generic_Handler_JSON/HandlerVBAlevelreportArchive.ashx?customerId=${Account.Text}&customerId2=${spnFirstName.SelectedItem}&customerId3=${Spinner1.SelectedItem}"$ )
    jt.GetRequest.Timeout = 10000 ' 10 seconds
    Wait For (jt) JobDone(jt As HttpJob)
    If jt.Success Then ' if job is success (http status code 200)
        Dim RetVal As String
        RetVal = jt.GetString
        Log(RetVal)
                        
        If jt.GetString = "[]" Then
            'MsgboxAsync("No Records to Upload Yet for: " & CustID ,"SMIS")
            Return
        Else
                                
            Dim parser As JSONParser
            parser.Initialize(jt.GetString)
            Dim root As List = parser.NextArray
            For Each colroot As Map In root
                Dim FieldName As String
                Dim FieldValue As String

                For I = 0 To colroot.Size - 1
                    'Log(colroot.GetKeyAt(I) & " = " & colroot.GetValueAt(I))
                    FieldName = colroot.GetKeyAt(I)
                    'Log(FieldName)
                    If FieldName.Trim.ToUpperCase.EndsWith("POINTS") Then
                        FieldValue = colroot.GetValueAt(I)
 
                        Select Case FieldValue.Trim.ToUpperCase
                            Case "A", "B", "C", "D", "E", "O","F"
                                                    
                                If FieldValue.Length <> 0 And FieldValue.Length <> 0 Then
                                    Log(FieldName.Trim & " = " & FieldValue.Trim)
                                    Starter.SQL1.ExecNonQuery2("INSERT INTO Alevelreport VALUES(?, ?, ?,?,?)", Array As Object(Account.Text,FieldValue.Trim, kname, FieldName.Trim ,"1"))
                                End If
                            Case "0", "1", "2", "3", "4", "5", "6","7", "8", "9", "10", "11", "12","13", "14", "15", "16", "17", "18", "19", "20"
                                Log("  (Numeric score for " & FieldName.Trim & FieldValue.Trim & ")")
                                Starter.SQL1.ExecNonQuery2("INSERT INTO Alevelreport VALUES(?, ?, ?,?,?)", Array As Object(Account.Text,FieldValue.Trim, kname, FieldName.Trim ,"1"))
                            Case "F"
                                'query = "CREATE TABLE Alevelreport (Account Text, Points Text,Name text,Subject text, ID INTEGER )"
                                Log("  (No good at " & FieldName.Trim & ")")
          
                        End Select
                                
                    End If
                                    
                Next
                                                                    
                jt.Release
                'StartActivity(DisplayAlevel)
                Return
                                
    
            Next
            
                    
        End If
    End If
 
Upvote 0
Top