monica1
17th June 2005, 12:13
I write this code, but it show me all the records no only the :num.mov I select. Where is the problem?
before.program:
import("tfcmg001.bank", tfcmg001.bank)
import("caso", caso)
import("num.mov", num.mov)
import("fecha.f", fecha.f)
import("fecha.t", fecha.t)
import("mi.mes", mi.mes)
import("year", year)
|** preparamos la query.extend
query.extend.select("tfcmg001.*", EXTEND_APPEND)
query.extend.from("tfcmg001", EXTEND_APPEND)
query = "tfcmg001._index1 = {:tfcmg001.bank} and " &
"tfcmg001.bpid.l = cacmg100.bank and " &
"tfcmg001.bano = cacmg100.bano and " &
"tfcmg001.badr = cacmg100.ofic "
if caso = 1 then
valido = tcyesno.no
|* programado en el main.table.io/ after.read.
endif
if caso = 2 then
query = query & "and cacmg100.date inrange :fecha.f and :fecha.t "
endif
if caso = 3 then
fecha.f = date.to.num(year, mi.mes, 1)
mi.mes = mi.mes + 1
if mi.mes > 12 then
mi.mes = 1
year = year + 1
endif
fecha.t = date.to.num(year, mi.mes, 1)
fecha.t = fecha.t - 1
query = query & "and cacmg100.date inrange :fecha.f and :fecha.t "
endif
query.extend.where(query)
main.table.io:
after.read:
if caso = 1 then
select cacmg100.bank, cacmg100.ofic, cacmg100.bano, cacmg100.date:date,
cacmg100.conc:conc, cacmg100.conp:conp, cacmg100.docu:docu
from cacmg100
where cacmg100._index1 = {:cacmg100.bank, :cacmg100.ofic, :cacmg100.bano}
order by cacmg100._index1 desc
as set with :num.mov rows
selectdo
if cacmg100.date = date and cacmg100.conc = conc and cacmg100.conp = conp and
cacmg100.docu = docu then
valido = tcyesno.yes
endif
endselect
if valido = tcyesno.no then
skip.io("")
endif
endif
If I want is if caso = 1 show only a concret number of records, if caso = 2 I only want to show the records between 2 dates, and if caso = 3 I want to show the record in a concret month.
The caso = 2 and caso = 3 works well but caso = 1 show me all the records.
Can you help me?
Thank you in advance,
before.program:
import("tfcmg001.bank", tfcmg001.bank)
import("caso", caso)
import("num.mov", num.mov)
import("fecha.f", fecha.f)
import("fecha.t", fecha.t)
import("mi.mes", mi.mes)
import("year", year)
|** preparamos la query.extend
query.extend.select("tfcmg001.*", EXTEND_APPEND)
query.extend.from("tfcmg001", EXTEND_APPEND)
query = "tfcmg001._index1 = {:tfcmg001.bank} and " &
"tfcmg001.bpid.l = cacmg100.bank and " &
"tfcmg001.bano = cacmg100.bano and " &
"tfcmg001.badr = cacmg100.ofic "
if caso = 1 then
valido = tcyesno.no
|* programado en el main.table.io/ after.read.
endif
if caso = 2 then
query = query & "and cacmg100.date inrange :fecha.f and :fecha.t "
endif
if caso = 3 then
fecha.f = date.to.num(year, mi.mes, 1)
mi.mes = mi.mes + 1
if mi.mes > 12 then
mi.mes = 1
year = year + 1
endif
fecha.t = date.to.num(year, mi.mes, 1)
fecha.t = fecha.t - 1
query = query & "and cacmg100.date inrange :fecha.f and :fecha.t "
endif
query.extend.where(query)
main.table.io:
after.read:
if caso = 1 then
select cacmg100.bank, cacmg100.ofic, cacmg100.bano, cacmg100.date:date,
cacmg100.conc:conc, cacmg100.conp:conp, cacmg100.docu:docu
from cacmg100
where cacmg100._index1 = {:cacmg100.bank, :cacmg100.ofic, :cacmg100.bano}
order by cacmg100._index1 desc
as set with :num.mov rows
selectdo
if cacmg100.date = date and cacmg100.conc = conc and cacmg100.conp = conp and
cacmg100.docu = docu then
valido = tcyesno.yes
endif
endselect
if valido = tcyesno.no then
skip.io("")
endif
endif
If I want is if caso = 1 show only a concret number of records, if caso = 2 I only want to show the records between 2 dates, and if caso = 3 I want to show the record in a concret month.
The caso = 2 and caso = 3 works well but caso = 1 show me all the records.
Can you help me?
Thank you in advance,