Andy..
1st December 2014, 19:12
I am calling a new subsession that refers to sales orderline and a new table
It seems to work fine with the code below in that it looks up the sales orderline that matches the custom table and you can scroll around records and it updates associated values fine
BUT when you run it as a subsession with the imported zoom values, it works fine tdtst041.orno is set to the zoom.orno value and seems like it will work UNTIL it reaches main.table.io where it resets tdtst041.orno to the first record in the table
I guess I'm doing something stupid, but I can't see it - Help!
before.program:
zoom.from.all:
on.entry:
import("zoom.orno", zoom.orno)
import("zoom.pono", zoom.pono)
select tdtst041.*
from tdtst041
where tdtst041._index1 = {:zoom.orno, :zoom.pono}
selectdo
|do nothing, allow edit
selectempty
|start insert record
execute(add.set)
endselect
|not necessary as values are setup already...
|if zoom.orno>0 then
| tdtst041.orno = zoom.orno
| tdtst041.pono = zoom.pono
|endif
main.table.io:
after.read:
|find sales orderline references
select tdsls041.*
from tdsls041
where tdsls041._index1 = {:tdtst041.orno, :tdtst041.pono}
selectdo
selectempty
message("Order/position " & str$(tdtst041.orno) & "/" & str$(tdtst041.pono) & " not found in tdsls041")
endselect
|lookup item desc
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:tdsls041.item}
selectdo
selectempty
endselect
vamsi_gujjula
1st December 2014, 19:57
i am just wondering, is the start command of the session first.set ?? in that case it will fetch the 1st record and more over there is no query.extension used.
what i understand is you are basically providing a maintain session for tdtst041 and also checking if its present in standard table tdsls041 , I feel you probably should be using query.extension ( so the the query set will have only zoomed order and therefore you main.table.io ==> after.read : will have only those order
mark_h
2nd December 2014, 16:17
I think Vamsi already cover the best option to look at with the start option - make it find or maybe refresh. I just wish in 4c4 you had some of the LN functionality for query extensions - rather than using before program section.
Andy..
3rd December 2014, 11:53
i am just wondering, is the start command of the session first.set ?? in that case it will fetch the 1st record and more over there is no query.extension used.
what i understand is you are basically providing a maintain session for tdtst041 and also checking if its present in standard table tdsls041 , I feel you probably should be using query.extension ( so the the query set will have only zoomed order and therefore you main.table.io ==> after.read : will have only those order
Hi, I have only used query.extension in BaanIV to limit/alter the existing query rather than adding another table - is it possible to use query.extension to add tdsls041 to the session in BaanIV?
Andy..
3rd December 2014, 12:38
I have rechecked the session is not calling 'first.set' and it isn't - if I change it to something obvious like 'insert' then it does the insert action. Now I have removed some code and end up with the following actual problem...
zoom.from.all:
on.entry:
import("zoom.orno", zoom.orno)
import("zoom.pono", zoom.pono)
import("zoom.orno", tdtst041.orno)
import("zoom.pono", tdtst041.pono)
message("orno=" & str$(tdtst041.orno) & " pono=" & str$(zoom.pono))
at this stage orno and pono are set to the zoomed values
main.table.io:
before.read:
|orderline()
message("orno=" & str$(tdtst041.orno))
by this time, orno is set to first record in the table
it doesn't matter what happens elsewhere in the code - as soon as it reaches main.table.io is resets orno to the first record!
bhushanchanda
3rd December 2014, 13:40
Hi,
Is this LN? You can write the code in before.display.object section.
Also, try to add a refresh.parent(-1) in before.program section.
mark_h
3rd December 2014, 17:15
What is the start option on the session? I will look for some same 4c4 code to show how I do query extensions. It basically filters on the main table. Then if I need fields from another table I build them in a couple of extra places.
mark_h
3rd December 2014, 17:54
Here is a complete sample script - don't get wrapped up in the skip.io code. It was the only way I could filter some tables where some of the filter fields were not on the actual table. You can also see where I display the revision which is in another table. This is a simple session where I build the query extension field to be used on the main table tdexi305.
|******************************************************************************
|* tdexi3505 0 VRC B40T c4 dev
|* No ACK Review session. Maintable is tdexi305.
|* Mark
|* 2014-05-06
|******************************************************************************
|* Main table tdexi305 PO Exostar Interface Table, Form Type 2
|******************************************************************************
|****************************** declaration section ***************************
declaration:
table ttdexi305 | PO Exostar Interface Table
table ttdexi320 | Exostar Response.
table ttdpur041 | PO Lines
table ttdudi040 | PO Extension Table
|Script fields
extern domain tcdate date.f, date.t | Date Filer
extern domain tcitem item.f, item.t | Item Filter
extern domain tcsuno suno.f, suno.t | Supplier Filter
extern domain tcemno buyr.f, buyr.t | Buyer Filter
extern domain tcorno orno.f, orno.t | Purchase Order filer
extern string q1(200)
|****************************** form section **********************************
before.program:
if background then
import("date.f",date.f)
import("date.t",date.t)
import("suno.f",suno.f)
import("suno.t",suno.t)
import("buyr.f",buyr.f)
import("buyr.t",buyr.t)
import("item.f",item.f)
import("item.t",item.t)
import("orno.f",orno.f)
import("orno.t",orno.t)
build.qry.ext()
else
item.f = ""
item.t = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
endif
|****************************** field section *********************************
field.tdexi305.orno:
after.display:
select tdudi040.revi
from tdudi040
where tdudi040._index1 = {:tdexi305.orno}
as set with 1 rows
selectdo
endselect
|****************************** form section **********************************
|****************************** choice section ********************************
|****************************** Main Table section ****************************
main.table.io:
after.read:
select tdpur041.orno, tdudi040.revi
from tdpur041, tdudi040
where tdpur041._index1 = {:tdexi305.orno}
and tdpur041.item inrange :item.f and :item.t
and tdudi040._index1 = {tdpur041.orno}
group by tdpur041.orno, tdudi040.revi
selectdo
select tdexi320.orno
from tdexi320
where tdexi320._index1 = {:tdexi305.orno}
and tdexi320.revi = :tdudi040.revi
as set with 1 rows
selectdo
| If it finds it in the 320 table then it is in AWE or ACK status.
skip.io("")
endselect
selectempty
| This will skip orders where the item is not in the range
| or the actual order is deleted.
skip.io("")
endselect
|****************************** function section ******************************
functions:
function build.qry.ext()
{
query.extension = ""
query.extension = "tdexi305._index1 inrange {" & str$(orno.f) &"} and {" & str$(orno.t) & "}"
query.extension = query.extension & " and tdexi305.date inrange " & str$(date.f) & " and " & str$(date.t)
if buyr.f <> 0 or buyr.t <> 999999 then
query.extension = query.extension & " and tdexi305.buyr inrange " & str$(buyr.f) & " and " & str$(buyr.t)
endif
if strip$(suno.f) <> "" or strip$(suno.t) <> "ZZZZZZ" then
query.extension = query.extension & " and tdexi305.suno inrange " & chr$(34) & suno.f & chr$(34) & " and " &
chr$(34) & suno.t & chr$(34)
endif
}
mark_h
3rd December 2014, 17:57
Just noticed something else:
zoom.from.all:
on.entry:
import("zoom.orno", zoom.orno)
import("zoom.pono", zoom.pono)
import("zoom.orno", tdtst041.orno)
import("zoom.pono", tdtst041.pono)
message("orno=" & str$(tdtst041.orno) & " pono=" & str$(zoom.pono))
For some reason I had an issue somewhere in the past importing directly into a table field. What I do is this:
zoom.from.all:
on.entry:
import("zoom.orno", zoom.orno)
import("zoom.pono", zoom.pono)
tdtst041.orno = zoom.orno
tdtst041.pono) = zoom.pono
message("orno=" & str$(tdtst041.orno) & " pono=" & str$(zoom.pono))
execute(find.data)
Went and checked one of my sessions:
zoom.from.all:
on.entry:
import("zoom.rfq",zoom.rfq)
tdexi020.rfqnum = zoom.rfq
execute(find.data)