ActiveVfP rest JSON integration Visual FoxPro prg
YEH! -- that did it -- I'm sure I'm going to have more questions / problems -- but YEH YEH YEH
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
YEH! -- that did it -- I'm sure I'm going to have more questions / problems -- but YEH YEH YEH
Happy Happy .... that link worked.
http://appery.io/app/mobile-frame?src...
Ok... I got pretty far. Now the rest will works, but I can't get the Form to give back the info. And I know the rest is Failing -- There is only 1 form to worry about -- and its the form that runs.
So the rest Query is failing and I know this because of a javascript warning I have.
In DEMO and test mode, the rest works fine.
Hi Mike,
Are there any problems we can help with?
When I hit enter -- it suppose to load the objects. I fought with the rest service, and its working, but I can't it to populate the inputs.
0001 and then enter -- does not find and return the info.
however if you test the rest service. 0001 works fine and returns what it suppose to. There is some simple glue problem.
thanks in advance -- bed for me -- up again at it in the morning.
my link above is public,
Hi Mike,
You should tick "Use Appery.io proxy".
Your application is working on a Appery.io domain. When it makes a request to the server located on another domain, request does not pass the browser for security reasons.
It works! Happy dance!
Ok ... (now some of this is for the FoxPro community) and I'm sure I've left some out.
I created a new master1 controller -- and used Query builder to make
an SQL joining my tables and making sure I had nothing but strings.
PROCEDURE getAction
LOCAL c_dispnum
c_dispnum = THIS.Params[1]
SET PATH TO oProp.AppStartPath+'prg\rest\controllers'
oJSON=NEWOBJECT('json','json.prg')
SELECT allt(str(towmast.dispnum)) as dispnum, dtoc(towmast.towdate) as towdate,;
Towmast.yearcar, Towmast.makecar, Towmast.modelcar, Towmast.colorcar,;
Towmast.calltype, dtoc(Towmast.datein) as datein, dtoc(Towmast.dateout) as dateout,;
Towmast.callactnum, Towmast.refnumber, Towmast.callname,;
Towmast.licensest, Towmast.licensenum, Towmast.callphone,;
allt(str(Towmast.days)) as days, Towmast.storagetype, Towmast.whocalled,;
allt(str(Towmast.perday)) as perday, allt(str(Towmast.perdaytotal)) as perdaytotal, Towmast.vin,;
Towmast.type, Towmast.tagmonthyear, Towmast.bodytype, Towmast.towedfrom,;
Towmast.towedto, Towmast.retowto, Towmast.cross_street, Towmast.odometer,;
Towmast.membernum, Towmast.liendout, Towmast.liendin, Towmast.lientype,;
Towmast.lientypems, allt(str(Towmast.lienfee)) as lienfee, Towmast.releaselic,;
Towmast.condition, Towmast.keysinfo, Towmast.holdnote,;
Towmast.callremark1, Towmast.aaacallnum, Towmast.priority,;
Towmast.equipment, Towmast.regnametow, Towmast.regname, Towmast.regaddr1,;
Towmast.regaddr2, Towmast.regaddr3, Towmast.regcity, Towmast.regstate,;
Towmast.regzip, Towmast.releasetype, Towmast.foxtow_id, Towmast.mapcord,;
Towmast.area, Towmast.ftiresize, Towmast.rtiresize, Towmast.wposition,;
Towdrive.invoicenum, Towdrive.driver, Towdrive.towtagnum,;
Towdrive.trucknum, Towdrive.timerec, Towdrive.timecall,;
Towdrive.timeinrt, Towdrive.timearrive, Towdrive.timeintow,;
Towdrive.timeardst, Towdrive.timeclear, dtoc(Towinv.invdate) as invdate,;
Towinv.itemgroup, Towinv.ponumber, Towinv.billtoact, Towinv.billtoname,;
Towinv.billtoaddr1, Towinv.billtoaddr2, Towinv.billtocity,;
Towinv.billtost, Towinv.billtozip, Towinv.billtophone, Towinv.billtocont,;
Towinv.paytype, dtoc(Towinv.release_date) as releasedate, Towinv.release_time,;
Towinv.release_bywho, Towinv.release_time2, Towinv.kitnum,;
Towinv.oldinvnum, Towinv.aaamemtype, allt(str(Towinv.miles)) as miles,;
allt(str(Towinv.milesto)) as milesto, dtoc(Received.datepaid) as datepaid, Received.custnum,;
Received.callactnum, Received.paytype, allt(str(Received.amount)) as amount,;
Received.referencenum;
FROM ;
towbox!towmast ;
INNER JOIN towbox!towdrive ;
ON Towmast.dispnum = Towdrive.dispnumdrv ;
INNER JOIN towbox!received ;
ON Towmast.dispnum = Received.dispnum ;
INNER JOIN towbox!towinv ;
ON Towmast.dispnum = Towinv.dispnum;
WHERE ALLTRIM(STR(Towmast.dispnum)) = c_dispnum;
INTO CURSOR searchresults
oJSON.keyforcursors="master"
send JSON data and properties back
oResponse.ContentType = "application/json;charset=utf-8"
oResponse.Write(oJSON.stringify('SearchResults'))
oResponse.Flush
lcHTMLout=[]
ENDPROC
===================================================
This call to my data ...
http://localhost:444/cfoxtow_webV3/ma...
Produced this json info.
{"master":{"rows":[{"aaacallnum":"","aaamemtype":"","amount":"465","area":"","billtoact":"COD","billtoaddr1":"","billtoaddr2":"","billtocity":"","billtocont":"","billtoname":"SANDY VANG","billtophone":"","billtost":"","billtozip":"","bodytype":"4 Door Sedan","callactnum_a":"CHPS","callactnum_b":"CHPS","callname":"CHP SOUTH","callphone":"( ) -","callremark1":"","calltype":"S","colorcar":"SILVER","condition":"DENTS SCRATCH 360","cross_street":"","custnum":"CHPS","datein":"01/03/12","dateout":"01/05/12","datepaid":"01/05/12","days":"3","dispnum":"200001","driver":"25","equipment":"","foxtow_id":"RINCON","ftiresize":"","holdnote":"","invdate":"01/05/12","invoicenum":"51004","itemgroup":"A","keysinfo":"YES","kitnum":"","licensenum":"4BWL376","licensest":"CA","liendin":"0000-00-00T00:00:00-08:00","liendout":"0000-00-00T00:00:00-08:00","lienfee":"0","lientype":"","lientypems":"","makecar":"BMW","mapcord":"","membernum":"","miles":"0","milesto":"0","modelcar":"5 series","odometer":"188379","oldinvnum":"","paytype_a":"CHK","paytype_b":"CHK","perday":"50","perdaytotal":"150","ponumber":"","priority":"","referencenum":"1723561","refnumber":"1035","regaddr1":"8275 HAYFIELD CIRCLE","regaddr2":"","regaddr3":"","regcity":"SACRAMENTO","regname":"","regnametow":"SANDY VANG","regstate":"CA","regzip":"95828","releasedate":"/ /","releaselic":"","releasetype":"","release_bywho":"DEIONNE","release_time":"11:38","release_time2":"","retowto":"","rtiresize":"","storagetype":"3","tagmonthyear":"09/12","timeardst":"","timearrive":"15:45","timecall":"","timeclear":"17:05","timeinrt":"15:35","timeintow":"16:30","timerec":"15:35","towdate":"01/03/12","towedfrom":"NORTHBOUND POWERINN AT STEVENSON","towedto":"8260 ALPINE AVE, SUITE A - SAC","towtagnum":"51004","trucknum":"3","type":"C","vin":"WBADE6327WBW61568","whocalled":"","wposition":"","yearcar":"98"}]}}True
now to find out if Appery.io is able to ready my json string.
My original one, I hand coded one by one. I'm trying to use a builder
here to make it go faster and be easier to change and add new tables
later.