DominicProgrammer
IS-IT--Management
Hi Good guys,
wud someone assist me track this foxpro code out, why is the json file coming with a "," @ the end of the file even if its coded not to?
Dominic
wud someone assist me track this foxpro code out, why is the json file coming with a "," @ the end of the file even if its coded not to?
Code:
** paytranf
Select transfile
pack
Set Deleted On
Set Relation To Code Into Type
GO top
SET ORDER TO empcode
Count To Xreccs2
Strtofile([[]+Chr(13)+lcCRLF, [c:\apps\infojson\transactions.txt], .F.)
SCAN
SCATTER memvar
zno=alltr(str(100-(recno()/recc()*100),13,4))
WAIT window nowait 'Retrieving Employee Transactions.... '+zno+' % remaining'+chr(13)+'Empl No:'+alltr(m.empno)+chr(13)+'Code:'+'-'+alltr(m.code) at 34,20 timeout 1
Strtofile([{]+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "employee_id":] +'"'+Alltrim(m.empno)+'"'+','+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "period":] +'"'+Dtoc(m.periodate)+'"'+','+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "transactions":] +" ["+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([{]+Chr(13)+[ "code"]+': '+Alltrim(transfile.code)+','+lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "name":] +'"'+Alltrim(Type.fulldesc)+'"'+','+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "hours":] +ALLTRIM(transform(transfile.hrs,[999999999.99]))+','+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ "amount":] +ALLTRIM(transform(transfile.amount,[999999999.99]))+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ }]+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([] +']'+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.)
Strtofile([ }]+Iif(Recno()<Xreccs2,',', '')+ lcCRLF, [c:\apps\infojson\employees.txt], .T.)
ENDSCAN
Strtofile([] +']'+ lcCRLF, [c:\apps\infojson\transactions.txt], .T.) && close object
Dominic