Wednesday, June 3, 2009

Adding routing information to RPBKLG

The client wanted to add the scheduled finish date of the last operation to the Sales Backlog report. (jodrtg.factschdfn) This code is inserted in a copy of the RPBKLG program after the main SQL select statement.... You first start by finding the last operation on the 0000 job. Second, you'll create a cursor that stores the JO and the scheduled finish date. Third, you'll join that to the information created by the main SELECT statement and return the slbklg cursor.

The M2MSelect function will joins the foxpro cursor with data from a SQL table.

lcSQL2 = 'SELECT jodrtg.fjobno, MAX(jodrtg.foperno) as maxopno from jodrtg group by jodrtg.fjobno '

IF SQLEXEC(1, lcSQL2, "csrmaxop") <>

M2MSelect(' SELECT csrmaxop.fjobno, csrmaxop.maxopno, ' + ;
'jodrtg.factschdfn ' + ;
'FROM csrmaxop ' + ;'LEFT OUTER JOIN M2Mdata!JODrtg ' + ;
' ON csrmaxop.fjobno = jodrtg.fjobno ' + ;
' and csrmaxop.maxopno = jodrtg.foperno' + ;
' into cursor csrmaxop1',SET('DATASESSION'),,'')

SELECT slbklg1.*, csrmaxop1.factschdfn ;
from slbklg1;
LEFT OUTER JOIN csrmaxop1 ON slbklg1.fjobno = csrmaxop1.fjobno ;
INTO CURSOR slbklg

No comments:

Post a Comment