<% oJSON=NEWOBJECT('json','json.prg') oresponse.expires=-1 SET NULL off SET DELETED ON accdata=orequest.form('accdata') *accdata=STRTRAN(accdata,[aaaa],[&]) theresponse='No Action' recordsadded=0 *templocation=addbs(oprop.appstartpath)+'temp\' IF NOT [NFJSON] $ SET("Procedure") SET PROCEDURE TO (addbs(oprop.appstartpath)+[prg\nfjson.FXP]) additive endif nfJsonToCursor(accdata, 'newaccdata',.f.) select [newaccdata] go TOP scatter name theaccback memo =usesafe('accounts') locate for allt(accounts.name)==allt(newaccdata.name) *=seek(newaccdata.accountid,[accounts],[accountid]) if eof() &&or not allt(accounts.name)==allt(newaccdata.name) theglc=left(newaccdata.accountid,2) if empty(theglc) theglc=[01] endif for i=1 to 9999 newcode=theglc+padl(allt(transform(i)),4,'0') if not seek(newcode,'accounts','accountid') Exit endif endfor append blank theaccback.accountid=newcode gather name theaccback endif thisac=accountid tsql=[select * from (']+dbclocation+[accounts') where accountid=']+thisac+[' into cursor tmpcursor] &tsql CURSORTOXML('tmpcursor','theresponse',1,0,0,'1') oResponse.ContentType = "application/xml;charset=windows-1252" oresponse.Write(theresponse) oresponse.flush CLOSE DATABASES CLOSE TABLES %>