This was my first time posting to this group and I can't believe the quick and knowledgeable responses... thanks a lot guys! I'll have to try to help out where I can from now on.
As far as my question goes, I just needed to Find the Orderhed table before using the updatetablebuffer. Here is my working code:
DEFINE VAR relWeight AS DECIMAL.
DEFINE VAR totWeight AS DECIMAL.
FOR EACH ttorderhed:
FIND FIRST orderhed WHERE ttorderhed.company = orderhed.company AND ttorderhed.ordernum = orderhed.OrderNum.
IF AVAIL ttorderhed THEN DO:
FOR EACH ttorderrel:
FOR EACH orderrel WHERE ttorderrel.company = orderrel.Company AND ttorderrel.OrderNum = orderrel.OrderNum AND ttorderrel.OrderLine = orderrel.OrderLine AND ttorderrel.OrderRelNum = orderrel.OrderRelNum:
FIND FIRST part WHERE ttorderrel.company = part.company AND ttorderrel.PartNum = part.PartNum.
IF AVAIL part THEN DO:
relWeight = part.NetWeight * ttorderrel.OurReqQty.
ttorderrel.number01 = relWeight.
RUN lib\UpdateTableBuffer.p(input BUFFER OrderRel:HANDLE, 'Number01', relWeight).
END.
END.
END.
FOR EACH orderrel WHERE ttorderhed.company = orderrel.company AND ttorderhed.ordernum = orderrel.OrderNum:
relWeight = orderrel.number01.
totWeight = totWeight + relWeight.
END.
ttorderhed.number04 = totWeight.
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE, 'Number04', totWeight).
END.
END.
As far as my question goes, I just needed to Find the Orderhed table before using the updatetablebuffer. Here is my working code:
DEFINE VAR relWeight AS DECIMAL.
DEFINE VAR totWeight AS DECIMAL.
FOR EACH ttorderhed:
FIND FIRST orderhed WHERE ttorderhed.company = orderhed.company AND ttorderhed.ordernum = orderhed.OrderNum.
IF AVAIL ttorderhed THEN DO:
FOR EACH ttorderrel:
FOR EACH orderrel WHERE ttorderrel.company = orderrel.Company AND ttorderrel.OrderNum = orderrel.OrderNum AND ttorderrel.OrderLine = orderrel.OrderLine AND ttorderrel.OrderRelNum = orderrel.OrderRelNum:
FIND FIRST part WHERE ttorderrel.company = part.company AND ttorderrel.PartNum = part.PartNum.
IF AVAIL part THEN DO:
relWeight = part.NetWeight * ttorderrel.OurReqQty.
ttorderrel.number01 = relWeight.
RUN lib\UpdateTableBuffer.p(input BUFFER OrderRel:HANDLE, 'Number01', relWeight).
END.
END.
END.
FOR EACH orderrel WHERE ttorderhed.company = orderrel.company AND ttorderhed.ordernum = orderrel.OrderNum:
relWeight = orderrel.number01.
totWeight = totWeight + relWeight.
END.
ttorderhed.number04 = totWeight.
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE, 'Number04', totWeight).
END.
END.
--- In vantage@yahoogroups.com, "Dan Sirow" <dansirow@...> wrote:
>
>
>
> I think you need to FIND the OrderHed with EXCLUSIVE-LOCK before you can update it with UpdateTableBuffer.p
>
> Also, you need an ASSIGN when updating a value of a table or temp-table, so ASSIGN ttorderhed.Number04 = totWeight will work
>
> Happy New Year to All !!
>
> --- In vantage@yahoogroups.com, "Jeff" <jeff.rogers@> wrote:
> >
> > I'm new to 4GL and am stumbling my way through a new post-process BPM to calculate and display the total release weights and the total order weight on the Order Entry screen. Calculating the release weights work and display great, but I can not get the total order weight to display (or update the orderhed table with the value) even though it is calculated correctly. Any feed back would be great! Keep in mind I'm on Vantage 8. Here's my 4GL code below:
> >
> > DEFINE VAR relWeight AS DECIMAL.
> > DEFINE VAR totWeight AS DECIMAL.
> >
> > FOR EACH ttorderhed NO-LOCK:
> > FOR EACH ttorderrel:
> > FOR EACH orderrel WHERE ttorderrel.company = orderrel.Company AND ttorderrel.OrderNum = orderrel.OrderNum AND ttorderrel.OrderLine = orderrel.OrderLine AND ttorderrel.OrderRelNum = orderrel.OrderRelNum:
> > FIND FIRST part WHERE ttorderrel.company = part.company AND ttorderrel.PartNum = part.PartNum.
> > IF AVAIL part THEN DO:
> > relWeight = part.NetWeight * ttorderrel.OurReqQty.
> > ttorderrel.number01 = relWeight.
> > RUN lib\UpdateTableBuffer.p(input BUFFER OrderRel:HANDLE, 'Number01', relWeight).
> > END.
> > END.
> > END.
> > FOR EACH orderrel WHERE ttorderhed.company = orderrel.company AND ttorderhed.ordernum = orderrel.OrderNum:
> > relWeight = orderrel.number01.
> > totWeight = totWeight + relWeight.
> > END.
> > ttorderhed.number04 = totWeight. /* NOT WORKING!!!*/
> > RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE, 'Number04', totWeight). /* NOT WORKING!!!*/
> > END.
> >
>