ltannous
9th February 2004, 21:41
How can I select 2 variables
eg

select tibom010.*
from tibom010
where tibom010.exdt > DATE.NUM()
or tibom010.exdt = 0
selectdo

When I use the "or" I get a execution error, but it compiles ok.
We need the 0 or blank option because most of the BOM lines have no expiry date while some have future exipry dates.

evesely
9th February 2004, 21:51
My experience has been that date.num() should not be used directly in a WHERE clause. You can either assign it to a variable outside of the SELECT statement or use a WHEREBIND. An example of the first method is:


domain tcdate date.use

date.use = date.num()
select tibom010.*
from tibom010
where tibom010.exdt > :date.use
or tibom010.exdt = 0
selectdo
...
endselect

bdittmar
11th February 2004, 12:50
Hello,

if you want to check the effictivity date of a bom component, do it in an function:

e.g.

function eff.date()
{
if tibom010.indt <= date.num() and (date.num() < tibom010.exdt
or tibom010.exdt = 0) then
effectivity.date = true
else
effectivity.date = true
endif
}


Regards Bernd

ltannous
17th February 2004, 21:08
It seems as if it is not using the function to check the bom dates.
Here is what I am trying to establish.
functions:

function read.main.table()
{
domain tcdate date.use, eff.date
date.use = date.num()
check.component.effectivity.date()
if effectivity.date = true then
select tdpsc001.*, tdpsc013.*, titem.dsca:item.dsca, tanl1.dsca:anl1.dsca,
tanl2.dsca:anl2.dsca, tcmcs002.*, tcuqp.dsca:cuqp.dsca,
tcupp.dsca:cupp.dsca, tatyp.dsca:atyp.dsca, tbtyp.dsca:btyp.dsca,
tmtyp.dsca:mtyp.dsca, tutyp.dsca:utyp.dsca, tcmcs070.*,tcmcs003.*, taodl.dsca:aodl.dsca, odl.dsca:bodl.dsca,
tmodl.dsca:modl.dsca, tuodl.dsca:uodl.dsca, tcmcs046.*,tcs074.*, tccom001.*
from tdpsc001, tdpsc013, tiitm001 titem, tcmcs072 tanl1, tcmcs072 tanl2, tcmcs002, tcmcs001 tcuqp, tcmcs001 tcupp,
tiitm001 tatyp, tiitm001 tbtyp, tiitm001 tmtyp, tiitm001 tutyp,
tcmcs070, tcmcs003, tcmcs071 taodl, tcmcs071 tbodl, tcmcs071tmodl,tcmcs071 tuodl, tcmcs046, tcmcs074, tccom001, tiitm001
where tdpsc001._index3 inrange {:item.f, :suno.f, :cont.f,
:pono.f}
and {:item.t, :suno.t, :cont.t, :pono.t}
and tdpsc001.suno refers to tdpsc013
and tdpsc001.item refers to titem
and tdpsc001.anl1 refers to tanl1
and tdpsc001.anl2 refers to tanl2
and tdpsc001.ccur refers to tcmcs002
and tdpsc001.cuqp refers to tcuqp
and tdpsc001.cupp refers to tcupp
and tdpsc001.atyp refers to tatyp
and tdpsc001.btyp refers to tbtyp
and tdpsc001.mtyp refers to tmtyp
and tdpsc001.utyp refers to tutyp
and tdpsc001.stat refers to tcmcs070
and tdpsc001.cwar refers to tcmcs003
and tdpsc001.aodl refers to taodl
and tdpsc001.bodl refers to tbodl
and tdpsc001.modl refers to tmodl
and tdpsc001.uodl refers to tuodl
and tdpsc001.clan refers to tcmcs046
and tdpsc001.ship refers to tcmcs074
and tdpsc001.cpln refers to tccom001
and tdpsc001.stat = "LV"
and tdpsc001.item = :tibom010.sitm
and tiitm001.item = :tibom010.mitm
and tiitm001.csig <> "OBS"
order by tdpsc001._index2
selectdo
rprt_send()

endselect
endif
}

function check.component.effectivity.date()
{
domain tcsern tmp.seqn
if (((tibom010.indt <= date.f) and (tibom010.exdt >= date.t) or
(tibom010.exdt = 0))) then
effectivity.date = true
select tibom010.*
from tibom010
where tibom010._index1 = {:tibom010.mitm,
:tibom010.pono}
order by tibom010._index1 desc
as set with 1 rows
selectdo
endselect
else
effectivity.date = false
endif
}

mark_h
17th February 2004, 21:37
From the previous posts it looks like you are using date.num(). But in your effectivity check it looks like you are using date.f and date.t. Is this some input range? Most of my effectivity checks use only one specified date as the previous post. In my subroutine the user provides the eff.date in the form. See below:


function check.component.effectivity.date()
{
domain tcsern tmp.seqn

if ((tibom010.indt <= eff.date) and (eff.date < tibom010.exdt or
tibom010.exdt = 0)) then
effectivity.date = true
select tibom010.mitm, tibom010.pono,
tibom010.seqn:tmp.seqn
from tibom010
where tibom010._index1 = {:tibom010.mitm,
:tibom010.pono,
:tibom010.seqn} | Added 011802
order by tibom010._index1 desc
as set with 1 rows
selectdo
seqn.stack(level) = tmp.seqn
endselect
else
effectivity.date = false
endif
}