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
Using AT on a Return on Url
-
- Posts: 484
- Joined: Wed Jan 27, 2010 10:25 pm
- Location: Berlin Germany
Re: Using AT on a Return on Url
if .not. empty(cresult)
or
if ValType(cresult) == "C"
or
if ValType(cresult) == "C"
_______________________
Best Regards
Wolfgang
Best Regards
Wolfgang
Re: Using AT on a Return on Url
Hi,
maybe sometimes there is a 'page not found' or another error.
You could test on the lenght of cResult as 'if (len(cResult)<500' then it can't be correct.
Sometimes I also check for a specific text in the file. If there should be a specific tag in the result (xml), you could test 'if 'specific tag' $ cResult'. If not, there is a problem.
maybe sometimes there is a 'page not found' or another error.
You could test on the lenght of cResult as 'if (len(cResult)<500' then it can't be correct.
Sometimes I also check for a specific text in the file. If there should be a specific tag in the result (xml), you could test 'if 'specific tag' $ cResult'. If not, there is a problem.
Re: Using AT on a Return on Url
The valtype is what I was looking for, just could not remember it.
Thanks
Thanks
Re: Using AT on a Return on Url
The ValType() you want for a NIL is this:
IF Valtype(cSomeValue) = 'U' // It's a NIL
IF Valtype(cSomeValue) = 'U' // It's a NIL
The eXpress train is coming - and it has more cars.