metropoj
24th September 2012, 18:29
Creating a new session and table def.

I dont do this kind of dev often so please bear with me.

I wrote some code to go out and fetch the current sales order number value and do a select stmt on my table to hopefully fetch the correct record. The debug shows it is grabbing the right order number but I never get the correct record in my custom table to show. I use the same domain in both tables and indexed based on orno .....


declaration:

table ttdsls960 | my table ...
table ttdsls400 | SO Table

extern domain tcorno orno | Order Number

|******** program section ****************


before.program:

import("tdsls400.orno",orno)

select tdsls960.*
from tdsls960
where tdsls960._index1 = orno
selectdo


selectempty



Am I even close in my thinking on this ???

Thanks for any suggestions. My searches have not revealed what i am looking for as of yet .....

mark_h
24th September 2012, 19:15
Try doing an execute(find.data) after the select.

metropoj
24th September 2012, 19:39
The whole "Before Program" or "Choice options" I am not very fluent with ..

For example, The code I had was in a Before program

but it doesn't like the execute(find.data) as it is 4GL ....

Right now the only thing in my script is to find the first record ....

metropoj
24th September 2012, 20:37
I made sure my new session was Specific Start Command 7 (find.data), I think that is correct

Trying to locate some examples of where best to place the execit(find.data) command ...

At least my query does find the current tdsls400.orno and also assigns the tdsls960.orno to the same values so taht's good, just no correct display yet !

BaanInOhio
24th September 2012, 20:39
select tdsls960.*
from tdsls960
where tdsls960._index1 = {:orno}
selectdo
:
:


Your 'orno' is never making it into the select statement from the zoomed variable.

mark_h
25th September 2012, 15:35
Other places to try using the zoom.


zoom.from.all:
on.entry:
import("zoom.rfqnum",zoom.rfqnum)
import("zoom.rfqline",zoom.rfqline)
select tdexi011.*
from tdexi011
where tdexi011._index1 = {:zoom.rfqnum,:zoom.rfqline}
as set with 1 rows
selectdo
selectempty
tdexi011.rfqnum = 0
endselect
execute(find.data)


Or you can try it in the before.form sections. I guess it would depend on how your session was getting launched.

metropoj
25th September 2012, 15:56
Thanks BaaninOhio for the syntax point out on the {:} and mark_h for the code example.

I was able to get it working without the execute command in this instance once I fixed my syntax :o

Thanks once again !

before.program:

import("tdsls400.orno",orno)


choice.find.data:
before.choice:

select *
from tdsls960
where tdsls960.orno = {:orno}
selectdo
selectempty
db.retry.point() |Start a transaction!
tdsls960.orno = orno
db.insert(ttdsls960, db.retry) |Insert record
commit.transaction() |Commit to database
endselect

metropoj
13th November 2012, 19:07
The LN session I created, with your help and guidance, imports the tdsls400.orno value and checks for a match in my custom table, inserts if no match as it does, etc. Works just fine until now that I want to expand it outwards more.....

I want to expand seeing fields from other tables as well and this is where i am stuck ...

I imported tdsls400.ofbp sold to BP and it displays fine. These are the default values of the session when it opens.

However, it doesn't update the value if I select another record using the forward backward arrows on my session. Nothing tied back to refresh those values ...

i also want to tie in and display the Business Partner description from tccom100.nama.

I have tried select statements to tie in either tables,
field.xxxx
before.display:
I cannot seem to get that relationship down properly.

I am not sure what section to create my select stmt to tie together my custom table order, to sls400.orno, and tdsls400,ofbp to tccom100 nama values.

Any help or guidance where to look would be appreciated ...

Thanks !

BaanInOhio
14th November 2012, 14:29
Put your custom logic to get other fields and prepare for display in the program section for "before.display.object" instead of a field section. This is executed each time a record is displayed, so you should have the fields read from other tables automatically displayed.

metropoj
14th November 2012, 17:24
before.display.object .... sigh. That's good info to know.


Thanks again. Now, i can select what i want and it actually stays refreshed !