Using AT on a Return on Url
Posted: Thu Sep 05, 2024 11:37 am
Roger,
We do a lot of url interfaces to import data. On one in particular where there are normally 4-5 pages involved, since they max out on their side, they send the next link part for the next page. We import these all day long, every 5 minutes or so.
There is also an option to start where it left off, but we have found that bypasses some of the data, just FYI.
Anyway, when it downloads a page it looks for the characters that stipulate there are more pages, checked each time.
//this part of the code
cResult := loadfromUrl(cUrl,,,,,"GET",,cHeader)
//dc_winalert(cResult)
xfile := '\\10.0.102.21\Omni\oiswin\vehiclelog'+str(n,1)+'.xml'
KEYIN=INKEY(5)
nLogHandle := FOpen(xfile,FO_READWRITE)
IF nLogHandle <= 0
nLogHandle := FCreate(xfile)
ENDIF
fwrite(nLogHandle, cResult )
FClose(nLogHandle)
//now see if another page
//"hasNextPage":false}
anotherpage=at(":true",cresult)
this may work for hundreds of times without an issue and we also have similar downloads of multi-pages (they limit to max characters)
Then we get this error.
oError:args :
-> VALTYPE: C VALUE: :true
-> VALTYPE: U VALUE: NIL
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: Y
oError:cargo : NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode : 2
i think that means it downloaded nothing, or the result was nil. So if that is correct, we need to check for a nil result before going any further.
Do not know how to do that, although think I have seen it somewhere.
Probably simple to you, but I am getting old..
thanks,
Fred
Omni
We do a lot of url interfaces to import data. On one in particular where there are normally 4-5 pages involved, since they max out on their side, they send the next link part for the next page. We import these all day long, every 5 minutes or so.
There is also an option to start where it left off, but we have found that bypasses some of the data, just FYI.
Anyway, when it downloads a page it looks for the characters that stipulate there are more pages, checked each time.
//this part of the code
cResult := loadfromUrl(cUrl,,,,,"GET",,cHeader)
//dc_winalert(cResult)
xfile := '\\10.0.102.21\Omni\oiswin\vehiclelog'+str(n,1)+'.xml'
KEYIN=INKEY(5)
nLogHandle := FOpen(xfile,FO_READWRITE)
IF nLogHandle <= 0
nLogHandle := FCreate(xfile)
ENDIF
fwrite(nLogHandle, cResult )
FClose(nLogHandle)
//now see if another page
//"hasNextPage":false}
anotherpage=at(":true",cresult)
this may work for hundreds of times without an issue and we also have similar downloads of multi-pages (they limit to max characters)
Then we get this error.
oError:args :
-> VALTYPE: C VALUE: :true
-> VALTYPE: U VALUE: NIL
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: Y
oError:cargo : NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode : 2
i think that means it downloaded nothing, or the result was nil. So if that is correct, we need to check for a nil result before going any further.
Do not know how to do that, although think I have seen it somewhere.
Probably simple to you, but I am getting old..
thanks,
Fred
Omni