How to truncate the eighth digit after decimal

Thanks Jim, it works like a charm.
--- In vantage@yahoogroups.com, "jckinneman" wrote:
>
> TRUNCATE ( expression , decimal-places )
>
> Jim Kinneman
> Encompass Solutions, Inc.
>
> --- In vantage@yahoogroups.com, "noor.fazli@" wrote:
> >
> > I wrote a abl code on pre-process in that calculates the reciprocal of ProdQty in JobEntry.CheckJobProdProdQty and display the reciprocal of prodQty in Asembly 1. Our requirement is that the it should display 7 digits after decimal which is already working from setting the extended properties of the field.
> > Code is working fine for most of the part
> > like for example if ProdQty = 10 ===>QtyPer = .1000000
> > if ProdQty = 20 ===> QtyPer = .0500000
> > but if ProdQty = 13 ===> Qtyper = .0769231 instead of .0769230(actually its ,0.0769230769230769), but its being rounded upward.
> > We just want to truncate the digits from the eighth decimal place . How can that be achieved in abl.Is there any floor function in abl, and if yes how to implement truncation at the eighth digit.
> >
> > Need help.
> >
> > ================ ABL Code =========================
> >
> > DEFINE VARIABLE deprodQ AS DECIMAL NO-UNDO.
> > define variable deQtyPer as decimal no-undo.
> > define variable deMillion as decimal no-undo.
> > deMillion = 10000000.
> > find first ttJobHead where ttJobHead.Company = Cur-comp no-lock no-error.
> > if avail ttjobhead then do:
> > find first JobAsmbl where JobAsmbl.JobNum = ttJobHead.Jobnum and JobAsmbl.AssemblySeq = 1 exclusive-lock.
> > if avail JobAsmbl then do:
> > assign deQtyPer = (1 / dProposedProdQty * deMillion) / deMillion.
> > assign JobAsmbl.QtyPer = deQtyPer.
> > {lib/Publishinfomsg.i &InfoMsg = deQtyPer }.
> > {lib/Publishinfomsg.i &InfoMsg = dProposedProdQty }.
> > end.
> > end.
> >
> > =====================================================
> >
>
I wrote a abl code on pre-process in that calculates the reciprocal of ProdQty in JobEntry.CheckJobProdProdQty and display the reciprocal of prodQty in Asembly 1. Our requirement is that the it should display 7 digits after decimal which is already working from setting the extended properties of the field.
Code is working fine for most of the part
like for example if ProdQty = 10 ===>QtyPer = .1000000
if ProdQty = 20 ===> QtyPer = .0500000
but if ProdQty = 13 ===> Qtyper = .0769231 instead of .0769230(actually its ,0.0769230769230769), but its being rounded upward.
We just want to truncate the digits from the eighth decimal place . How can that be achieved in abl.Is there any floor function in abl, and if yes how to implement truncation at the eighth digit.

Need help.

================ ABL Code =========================

DEFINE VARIABLE deprodQ AS DECIMAL NO-UNDO.
define variable deQtyPer as decimal no-undo.
define variable deMillion as decimal no-undo.
deMillion = 10000000.
find first ttJobHead where ttJobHead.Company = Cur-comp no-lock no-error.
if avail ttjobhead then do:
find first JobAsmbl where JobAsmbl.JobNum = ttJobHead.Jobnum and JobAsmbl.AssemblySeq = 1 exclusive-lock.
if avail JobAsmbl then do:
assign deQtyPer = (1 / dProposedProdQty * deMillion) / deMillion.
assign JobAsmbl.QtyPer = deQtyPer.
{lib/Publishinfomsg.i &InfoMsg = deQtyPer }.
{lib/Publishinfomsg.i &InfoMsg = dProposedProdQty }.
end.
end.

=====================================================
TRUNCATE ( expression , decimal-places )

Jim Kinneman
Encompass Solutions, Inc.

--- In vantage@yahoogroups.com, "noor.fazli@..." wrote:
>
> I wrote a abl code on pre-process in that calculates the reciprocal of ProdQty in JobEntry.CheckJobProdProdQty and display the reciprocal of prodQty in Asembly 1. Our requirement is that the it should display 7 digits after decimal which is already working from setting the extended properties of the field.
> Code is working fine for most of the part
> like for example if ProdQty = 10 ===>QtyPer = .1000000
> if ProdQty = 20 ===> QtyPer = .0500000
> but if ProdQty = 13 ===> Qtyper = .0769231 instead of .0769230(actually its ,0.0769230769230769), but its being rounded upward.
> We just want to truncate the digits from the eighth decimal place . How can that be achieved in abl.Is there any floor function in abl, and if yes how to implement truncation at the eighth digit.
>
> Need help.
>
> ================ ABL Code =========================
>
> DEFINE VARIABLE deprodQ AS DECIMAL NO-UNDO.
> define variable deQtyPer as decimal no-undo.
> define variable deMillion as decimal no-undo.
> deMillion = 10000000.
> find first ttJobHead where ttJobHead.Company = Cur-comp no-lock no-error.
> if avail ttjobhead then do:
> find first JobAsmbl where JobAsmbl.JobNum = ttJobHead.Jobnum and JobAsmbl.AssemblySeq = 1 exclusive-lock.
> if avail JobAsmbl then do:
> assign deQtyPer = (1 / dProposedProdQty * deMillion) / deMillion.
> assign JobAsmbl.QtyPer = deQtyPer.
> {lib/Publishinfomsg.i &InfoMsg = deQtyPer }.
> {lib/Publishinfomsg.i &InfoMsg = dProposedProdQty }.
> end.
> end.
>
> =====================================================
>
Thanks Jim, it works as desired.

--- In vantage@yahoogroups.com, "jckinneman" wrote:
>
> TRUNCATE ( expression , decimal-places )
>
> Jim Kinneman
> Encompass Solutions, Inc.
>
> --- In vantage@yahoogroups.com, "noor.fazli@" wrote:
> >
> > I wrote a abl code on pre-process in that calculates the reciprocal of ProdQty in JobEntry.CheckJobProdProdQty and display the reciprocal of prodQty in Asembly 1. Our requirement is that the it should display 7 digits after decimal which is already working from setting the extended properties of the field.
> > Code is working fine for most of the part
> > like for example if ProdQty = 10 ===>QtyPer = .1000000
> > if ProdQty = 20 ===> QtyPer = .0500000
> > but if ProdQty = 13 ===> Qtyper = .0769231 instead of .0769230(actually its ,0.0769230769230769), but its being rounded upward.
> > We just want to truncate the digits from the eighth decimal place . How can that be achieved in abl.Is there any floor function in abl, and if yes how to implement truncation at the eighth digit.
> >
> > Need help.
> >
> > ================ ABL Code =========================
> >
> > DEFINE VARIABLE deprodQ AS DECIMAL NO-UNDO.
> > define variable deQtyPer as decimal no-undo.
> > define variable deMillion as decimal no-undo.
> > deMillion = 10000000.
> > find first ttJobHead where ttJobHead.Company = Cur-comp no-lock no-error.
> > if avail ttjobhead then do:
> > find first JobAsmbl where JobAsmbl.JobNum = ttJobHead.Jobnum and JobAsmbl.AssemblySeq = 1 exclusive-lock.
> > if avail JobAsmbl then do:
> > assign deQtyPer = (1 / dProposedProdQty * deMillion) / deMillion.
> > assign JobAsmbl.QtyPer = deQtyPer.
> > {lib/Publishinfomsg.i &InfoMsg = deQtyPer }.
> > {lib/Publishinfomsg.i &InfoMsg = dProposedProdQty }.
> > end.
> > end.
> >
> > =====================================================
> >
>