Ruskin
27th August 2002, 06:12
Hmmm..... I have come across something strange, using choice sections, in a session that has a synchronized dialog and was wondering if any one else had encountered the same problem and what they did to resolve it...

In the before.program section, there is a statement similar to;
set.synchronized.dialog("ppmmmxxxxs000")

Thus, when an occurrence is double-clicked (to modify), or is duplicated, or inserted, this sub session is started. The occurrence on the main session, is then updated when the sub session values are inserted, or modified (as the main session is now synchronized with the occurrence being edited in the sub session).

I have done the following;

choice.modify.set:
before.choice:
message("START MODIFY")

and I get a "START MODIFY" message when I double click an occurrence. However, if I add;

after.choice:
message("END MODIFY")

I do not get the message "END MODIFY". Putting in Debug, also shows, that the after.choice sub section is not run. This is causing an issue, as the sub session that is activated, updates other records in the code (based on values entered in this sub session). When the sub session is closed, the other occurrences in the main session, do not reflect the changes made in the sub session. The after.choice section does not seem to be running, so I can't perform an execute(find.data) or some other refresh. The only work around I have found, is when the sub session closes a message is displayed to the user telling them to push F5 to refresh the main session.

Is there a way to capture that the synchronized dialog session has been started and closed, from the main session? Alternatively, is there a way to refresh all occurrences on the main session, from the sub session?

jaapzwaan
27th August 2002, 09:58
Please try calling the function refresh.parent(-1). I know it is not in the manual, but that's an error in the manual :eek: , not because it is unsupported.
The omission in the manual has been logged and will be corrected in the next version.

Regards,
Jaap

rupertb
27th August 2002, 10:09
I've tried this logic - with no joy at all:( I think the modify.set option is expecting an event like save or save&exit or <esc> before it'll jump from the before.choice to after.choice section - can you not use the standard field zooming and then execute the refresh code in the after.zoom portion of the field.all section?

Happy zooming,
Rupert

jaapzwaan
27th August 2002, 11:33
You should use the function refresh.parent(1) in the synchronized dialog , not in the parent itself (hence its name).
This function causes the parent to reread the data and get latest information from the child.

Regards,
Jaap

Ruskin
27th August 2002, 23:26
Thanks Jaap,

I used the refresh.parent(-1) option and it work perfectly (refreshed all occurences on the parent). Just a quick question, but since this is not documented, do you know the parameters that can be passed. The reason I ask, is that refresh.parent(1) did not work, but passing -1 did, but caused the occurrences on the parent, to scroll up to the occurrence selected (if that makes sense).


regards...
Ruskin

jaapzwaan
29th August 2002, 14:30
The function refresh.parent requires only one argument (type long). This is the occurrence number of the child that should be send to the parent.
In normal circumstances, this is a 1 because the synchronized dialog normally is a single occurrence view.
If (for whatever reason) the synchronized child is a multi-occ, you can specify the occurrence of the changed object. This way you can update the parent with data of the child that has not yet been written to the database.
A -1 causes a simple reread of the database in the parent process.

Regards,
Jaap

kiran kumar
18th March 2008, 09:43
hi i am kiran

can any body give me idea or send me sample code to how to add two forms in single session like( purchse order lines or sales order lines with header n detail)?

bi

mark_h
18th March 2008, 15:33
Look at help on sattr.combined and switch.to.process(). Below are snippets of code that I use. I did not post all the code, because the only time I did this I really had to reverse how baan does it. Baan usually has like the lower single occurance session being the parent and the upper session being a multi-occurance session. But the below should give you an idea and the Baan help should explain further.

| Parent Session
before.program:
sattr.combined = COMBINED.TOP
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION **************************
form.1:
init.form:
get.screen.defaults()
disable.resize()
before.form:
process.udi9510 = activate("tiudi9510s002")
switch.to.process(process.udi9510)

|****************************** CHOICE SECTION ***************************
choice.end.program:
before.choice:
kill.subprocesses()

choice.abort.program:
before.choice:
kill.subprocesses()

choice.find.data:
before.choice:
hold.osta = tisfc001.osta

after.choice:
export("instruction",instruction)
status.off()
switch.to.process(process.udi9510, SWITCH.SAME.SIZE)
status.on()


|From child session
before.program:
disable.resize()
|get.screen.defaults()
sattr.combined = COMBINED.BOTTOM
fattr.toplines = 1
wait.for.switch()

form.1:
init.form:
slash = "/"
if background then
while true
import("tisfc001.pdno",tisfc010.pdno)
tisfc010.opno = 0
inputfield.invisible("tisfc010.pdno")
import("instruction", instruction)
on case instruction
case find.data:
execute(find.data)
break
case last.set:
execute(last.set)
break
case first.set:
execute(first.set)
break
break
case next.set:
execute(next.set)
break
case prev.set:
execute(prev.set)
break
case resize.frm:
execute(resize.frm)
break
case 34:
tisfc951.pdno = tisfc010.pdno
ticst001.pdno = tisfc010.pdno
import("zoom.prog", zoom.prog)
zoom.to$(zoom.prog,z.session,"","",0)
break
default:
display.all()
endcase
switch.to.process(parent, SWITCH.SAME.SIZE)
endwhile
endif

MilindV
18th March 2008, 18:56
I dont know whether i undestand ur problem exactly. But According to me. solution to ur problem is session of type multi-main table. But This type is available in LN only(I think). in this type of session there is one main session and others are sub-sessions of that session called as satellite sessions.
I hope this is the ans to ur question.