skommu
11th October 2002, 17:54
Hi,

I am trying to export the Data to Ascii / Report for other needs of third party package for the items having signal code "PRE" or "ROU" . Once this ascii file was exported then I want to update the signal code with "ORT". It means my script has to perform two tasks.

1. It has to export data for the items of signal code "PRE" or " ROU" .

2. Update the tiitm001.csig(signal code) to "ROU".

With the below script I can able to update to "ORT" but in the Ascci/Report I am getting a message " No data with in the selection".

Function read.main.table()
{
select tiedm100.eitm
from tiedm100
where tiedm100.exdt = 0
and tiedm100.indt > 0
and tiedm100.eitm between :item.f and :item.t
selectdo
select tiitm001.csig, tiitm001.item
from tiitm001 for update
where tiitm001.item = :tiedm100.eitm
and (titim001.csig = "PRE" or tiitm001.csig = "ROU")
and tiitm001._index1 inrange {:item.f}
and {:item.t}

selectdo
tiitm001.csig = "ORT"
db.update(tiitm001,db.retry)
endselect
commit.transaction()
endselect
}

gfasbender
11th October 2002, 18:18
Your post is confusing..

I don't see any code that sends records to a report?

Also, if your db.update isn't working, change you're line db.update(tiitm001,db.retry) to db.update(ttiitm001,db.retry)

skommu
11th October 2002, 18:33
For to get a report I have to write a separate Array ?

gfasbender
11th October 2002, 19:06
A report session script usually has a structure something like this:

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
build.report()
rprt_close()
else
choice.again()
endif

functions:
function build.report()
{
select tiedm100.eitm
from tiedm100
where tiedm100.exdt = 0
and tiedm100.indt > 0
and tiedm100.eitm between :item.f and :item.t
selectdo
select tiitm001.csig, tiitm001.item
from tiitm001 for update
where tiitm001.item = :tiedm100.eitm
and (titim001.csig = "PRE" or tiitm001.csig = "ROU")
and tiitm001._index1 inrange {:item.f} and {:item.t}
selectdo
tiitm001.csig = "ORT"
db.update(tiitm001,db.retry)
rprt_send()
endselect
commit.transaction()
endselect
}

Armando_Rod2000
14th October 2002, 01:10
Your post is so confusing but i think that you are looking for update a field and expor your data updated. I think that your code must ..:
Function read.main.table()
{
select tiedm100.eitm
from tiedm100
where tiedm100.exdt = 0
and tiedm100.indt > 0
and tiedm100.eitm between :item.f and :item.t
selectdo

db.retrypoint()

select tiitm001.csig, tiitm001.item
from tiitm001 for update
where tiitm001.item = :tiedm100.eitm
and (titim001.csig = "PRE" or tiitm001.csig = "ROU")
and tiitm001._index1 inrange {:item.f}
and {:item.t}

selectdo
tiitm001.csig = "ORT"
db.update(tiitm001,db.retry)
endselect
commit.transaction()

endselect
}