outra9e
4th September 2002, 11:33
Guys

can anyone tell me how to use tools tables in scripts?

I have declared the table as I would any other table and then here is my script ...

*************************************************
function get.default.company()
{

select ttaad200.uusr
where ttaad200.uusr = :logname$
selectdo
if ttaad200.comp = 501 then
tdsls901.nregn = tdsls.regn.TEE
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 502 then
tdsls901.nregn = tdsls.regn.TED
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 503 then
tdsls901.nregn = tdsls.regn.TEF
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 504 then
tdsls901.nregn = tdsls.regn.TEE
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 505 then
tdsls901.nregn = tdsls.regn.TEI
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 506 then
tdsls901.nregn = tdsls.regn.TER
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 501 then
tdsls901.nregn = tdsls.regn.TEE
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 501 then
tdsls901.nregn = tdsls.regn.TEE
display("tdsls901.nregn")
refresh()
endif
if ttaad200.comp = 509 then
tdsls901.nregn = tdsls.regn.TEY
display("tdsls901.nregn")
refresh()
endif
endselect
}
**************************************************

When hitting the field though in the session, it says that the table does not exist.

It definately does though!

Any ideas?

Cheers

Juergen
4th September 2002, 12:37
add the companynr. for the tools company to your select statement.

Example:

select ttadv300.cfrm
from ttadv300
where ttadv300._compnr = 000
and ttadv300._index2 = ..........
.......

Jürgen

OmeLuuk
4th September 2002, 13:16
Indeed, all tools data is stored in table 000. There are only few exceptions for tools tables that are also in the application company, including tttxt text tables, some ttaad job tables.

outra9e
4th September 2002, 13:29
So you mean like this ....

************************************************
select ttadv300.crfm, ttaad200.uusr
where ttadv300._compnr =000 and ttaad200.uusr = :logname$
selectdo......................
************************************************

Is that right?

Cheers

jaapzwaan
4th September 2002, 13:34
....
and replace the if statements by a "on case": the compiler will warn you that you check 3 times against company 501.
Putting the "display("....") outside the case statement will save you another 8 lines.

.....

Regards,
Jaap

Juergen
4th September 2002, 14:03
Andy,

the select for table ttadv320 was only means as an example.
You do no need this table in your statement.

Jürgen

outra9e
4th September 2002, 14:53
So if I was to use this ...

************************************************
select ttaad200.uusr
where ttaad200._compnr =000 and ttaad200.uusr = :logname$
selectdo......................
************************************************
Would that be ok?

Cheers

Juergen
4th September 2002, 15:08
lets rock!

Jürgen