B4R Question Reading Job.Response value

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hi
I tried many times/approach to read job.response value and compare it, always failed!

Request url that response with 0 or 1 only without any space:
 HttpJob.Initialize("job1")
 HttpJob.Download("url")

Comparison inside select Not work:
Sub JobDone (Job As JobResult)
    If Job.Success Then
        If Job.JobName="job1" Then
            'always job.response=1 or 0
            Select Job.Response
                Case "0".GetBytes
                    Log("0")
                Case "1".GetBytes
                    Log("1")
            End Select
        End If
    End If
End Sub

Comparison inside select Not work:
Sub JobDone (Job As JobResult)
    If Job.Success Then
        If Job.JobName="job1" Then
            'always job.response=1 or 0
            Select Job.Response
                Case "0"
                    Log("0")
                Case "1"
                    Log("1")
            End Select
        End If
    End If
End Sub

Comparison inside select Not work:
Sub JobDone (Job As JobResult)
    If Job.Success Then
        If Job.JobName="job1" Then
            'always job.response=1 or 0
            Select Job.Response
                Case 0
                    Log("0")
                Case 1
                    Log("1")
            End Select
        End If
    End If
End Sub

What is the wrong?
 

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Job.response log print 1 or 0 no problem
The problem when you check if it is 1 or 0 programmatically! Not work!!!
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
I figured out the problem, it is SELECT statement : simply Select/Case not working in B4R, WHY? any explanation.
Working:
Sub JobDone (Job As JobResult)
    If Job.Success Then
        If Job.JobName="job1" Then
            'always job.response=1 or 0
            if Job.Response="0" Then Log("0")
            if Job.Response="1" Then log("1")
        End If
    End If
End Sub
Not working using Select/Case:
Sub JobDone (Job As JobResult)
    If Job.Success Then
        If Job.JobName="job1" Then
            'always job.response=1 or 0
            Select Job.Response
                Case "0"
                    Log("0")
                Case "1"
                    Log("1")
            End Select
        End If
    End If
End Sub
 
Upvote 0
Top