mr_suleyman
18th October 2005, 14:54
Hi All , I wonder that How can I handle to combine two session ? What are program structure's steps and command that I should use ? I need your help
Could you explain the mechanism in combined sessions ?
Thanks for your suggestions !
toolswizard
18th October 2005, 15:10
I can interpret your request two ways. First you want to execute two seperate sessions. If that is the case you may want to research AFS.
If you are speaking of splitting the screen and having two session cooperate with each other, you should review Maintain Sales Order Lines. There are two session combined, a display that controls the top portion, and a maintain that controls the lower portion. The maintain intercepts all choices and the display is a slave witing for messages from the maintain.
Hitesh Shah
18th October 2005, 16:48
Think u are talking of combined sessions with combined forms. U can see many examples of combined session like tdsls4102s000 , tisfc0102m000 etc .
Also the help for switch.to.process is quite elaborate in this matter. Main program has to issue choice commands to child program for each user actions .
mr_suleyman
18th October 2005, 16:56
Thanks for your reply. I know those sessions like maintain sales order session or other sessions. But I don't know their mechanism in program because I don't have source codes of these standart session. Could you send sample source code ?
Thank you !
erphui
19th October 2005, 04:04
The work mechanism is to loadinng a sub-sessiong to show two Forms in a session.
form.1:
init.form:
activate.process.sls4503s000()
function activate.process.sls4503s000()
{
if not procnr.sls4503s000 then
status.off()
if tipcf000.ppcf = tcyesno.no and
tipcs000.ipcs = tcyesno.no then
procnr.sls4503s000 = activate("tdsls4504s000")
#pragma used session tdsls4504s000
else
procnr.sls4503s000 = activate("tdsls4503s000")
#pragma used session tdsls4503s000
endif
status.on()
endif
}
manojsharma
19th October 2005, 11:40
Hi Suleyman,
There is a predefined variable sattr.combined a in baan. You can find similar thread on this topic on baanboard.
mr_suleyman
19th October 2005, 11:57
Thank all for replies. I will search your feedback ! But we use Baan4 c3 . I hope that your information is enough .
Thanks all ...
dorleta
19th October 2005, 12:05
look in help , manual page the command swith.to.process
ít is short and understandable
goold luck
Francesco
19th October 2005, 17:47
See attachments. Hope this will help you.
The basic concept is to capture all possible events in your main session and direct them to the child session as needed.
NPRao
19th October 2005, 21:06
I couldn't find it in the latest Tools manual, I had to go back to the BaaN-4 manual to get more details. Here is more information for other's benefit -
SWITCH.TO.PROCESS
--------------------------------------------------------------------------------
shortdesc functions for switching between a parent process and an activated child
nfdesc If a process zooms often to a specific zoom process, then these functions avoid the startup of the zoom process over and over again.
In normal situations a process simply calls zoom.to$(). If zooming to this zoom session happens often, the zoom session has to be loaded in memory and removed from memory for every zoom.to$. To avoid this situation, the following statement sequences WERE programmed:
Parent Child
declaration: declaration:
extern long instruction long instruction
form.1: before.program:
init.form: receive.bucket$(id)
child.id = activate("child")
send.wait(child.id, "") form.1:
init.form:
choice.next.set: while true
after.choice: import("instruction",
instruction = next.set instruction )
send.wait(child.id, "") execute(instruction)
send.wait(parent, "")
choice.end.program: endwhile
before.choice:
kill(child.id)
These functions don't give the desired effect in the new graphical interface, because the functions send.wait and receive.bucket$ are defined in the bshell. However the standard program has to repaint the graphical form of the called process and the server for maintaining the toolbar and menu bar has to be informed about the settings of the new process. Therefore the following functions have been created.
The function SWITCH.TO.PROCESS sends a signal to a process identified by processno (usually a child which has been created with activate, or the parent that has created this process with activate) and will wait until the other process sends a SWITCH.TO.PROCESS to this process. Possible flags (see below):
SWITCH.SAME.SIZE
SWITCH.WITHOUT.INTERACTION
SWITCH.WITHOUT.WAIT
WAIT.FOR.SWITCH will wait for another process to call SWITCH.TO.PROCESS. This function is typically used at the startup of the zoom process for synchronization purposes. Possible flags (see below):
SWITCH.SAME.SIZE
SWITCH.WITHOUT.INTERACTION
Example of new situation for graphical environment:
Parent Child
declaration declaration:
extern long instruction long instruction
form.1: before.program:
init.form: wait.for.switch()
child.id = activate("child")
switch.to.process(child.id) form.1:
init.form:
choice.X: while true
after.choice: import("instruction",
instruction = X instruction)
switch.to.process(child.id) execute(instruction)
switch.to.process(parent)
endwhile
In other situations where send.wait and receive.bucket$ are used, there is no need for changes.
The variable sattr.combined should be used if the forms of the two processes should not overlap. This variable should be set in the before.program section. Possible values:
COMBINED.BOTTOM form stays below other process' form
COMBINED.TOP form stays on top of other process' form
COMBINED.RIGHT form stays at the right of other process' form
COMBINED.LEFT form stays at the left of other process' form
If the two processes should be of the same width or height, the value SWITCH.SAME.SIZE should be added to the flag argument.
Example of overlapping forms:
+-----------------------+
| proc1 |
| |
|---------------+ |
| proc2 | |
| |-------+
| |
+---------------+
Result of setting sattr.combined to COMBINED.TOP in proc1 and setting sattr.combined to COMBINED.BOTTOM in proc2:
+-----------------------+
| proc1 |
| |
| |
| |
|-----------------------+
| proc2 |
| |
| |
+---------------+
Result of setting flag to SWITCH.SAME.SIZE (only necessary in process with form at the bottom) in proc2 and setting variable sattr.combined as above:
+-----------------------+
| proc1 |
| |
| |
| |
|-----------------------|
| proc2 |
| |
| |
+-----------------------+
Switching to another process also passes the input control to that process. This results in setting the current form inactive and setting the other form active. If it is not necessary to switch the focus to the other form (e.g. the other process is a display process without interaction), the flag SWITCH.WITHOUT.INTERACTION should be set. This flag should only be set in the process passing the control to the process without interaction.
E.g.: proc2 is a single-occurrence session for maintaining an order line and proc1 is a multi-occurrence session, displaying the other order lines of the same order header. The user is not able to input on fields of proc1 nor able to enter commands for proc1. Only the switch.to.process call of proc2 should have the flag SWITCH.WITHOUT.INTERACTION set.
To stop synchronization between the processes, set the flag argument to SWITCH.WITHOUT.WAIT. This should be used if the other process stops after receiving the switch.
Example:
choice.end.program:
on.choice:
instruction = end.program
switch.to.process( child.id, SWITCH.WITHOUT.WAIT)
| immediate return, no wait for return signal
mr_suleyman
20th October 2005, 08:03
Thank you for your feedback. It works well.
vineetu1
14th April 2009, 14:33
Is it possible to have both the sessions be maintian sessions ?
mark_h
14th April 2009, 15:42
Yes - it is possible to have two maintain sessions as one. A lot of work to keep the two sessions in sync. So I have the header at the top as single occurrence and the lines at the bottom as multi-occurrence. To modify the header I had to put a button on the form to pass the event "modify.set" to the sub-session for the header. It works not very elegant, but it is feasible. You just have to map what happens in the main session to what happens in the sub-session.
joepte
27th March 2012, 22:41
Hi Mark et. al.,
Is it possible to take the 2 sessions approach with single occ on top and multi occ on the bottom and have 3 forms? Can each form read different tables so that you might have 5 occurances (records) on form 1 and just 3 records on form 3 and perhaps 1 occ on form3? Can Baan do this? (can I do this?? - do you think it is overly complex)
regards
mark_h
28th March 2012, 16:00
It might be possible. Not 100% sure because I think when you click on the form you could switch to a different session with a different main table. It is not something I recommend. You really have to do a lot of coding to keep everything in sync with the two sessions.
Attaching two jpgs - one is a little maintain session I created. Each form is from a different session and different maintain. Not much coding to do it, but I am the only one that used to use it. It was kind of nice when you had something in inventory get out of sync. The session is also anchored to left hand corner of the screen. Even if you drag it somewhere when the next session starts it moves it back to the corner - have not used it since I got dual screens. Added - Just tested it, you do not want to move it to the second screen.
The second jpg is of a session I did that users actually use. This session required a lot of coding to keep things in sync between the header and the footer session or records. I think sometimes they can still get out of sync, but I have not found the right sequence of events that causes it. You can see it uses multiple forms, but from the same table.
So I do not want to say it is not possible. As a matter of fact at one time I had a session that displayed a ticst030 table(I think that was it) and tisfc010. What this session did was say for the header record if the order is closed use sessions a and b to display planning for the order using ticst tables, if not closed use session c and d to display planning for the order. The forms for the 4 sessions were about identical and you could not tell which table was being used. It kind of worked - what would happen at times was that the forms would not line up and might even resize themselves. I think you definetely have to turn off resizing and moving the sessions on the screen also might cause problems. That session was scrapped thankfully and it was all because the users did not want to use two sessions to see closed and not closed orders.
joepte
28th March 2012, 17:38
Thanks Mark.
Re your second image: if you entered 3 reords on form 1 would that create 3 records on form 2 as well? i.e. assuming form 2 is also multiocc could you have 4 or 5 records on form 1 and just 1 or 2 records on form 2? When I don't use any parent/child method whenever I create a record on form 1 it creates the corresponding record (even if it is all blank) on form 2.
Regards....
mark_h
28th March 2012, 19:56
In my case yes since it was all the same table - if I created a new record on form 1, then form 2 would have the same number of records. In my case the form 2 fields were fields I could not get onto form 1. In my case both the forms are tied to the same same main session that gets started. I failed to mention the mainsession is the bottom session with 2 forms. The top session is the single occurence session that is a subsession.
joepte
29th March 2012, 15:31
Thanks again Mark.
Hitesh Shah
29th March 2012, 19:19
joepte
i believe mark clarified everything .
In B4 u can not not have diff main table for different forms in a session .
You can however combine 2 session (one display and on maintain/display ) with with 2 different main tables if there is proper relation between it and u write appropriate syncronization dialog. One display will be subsession / child session with interaction with user only through parent / main session.
Development of combined session does take some time with good time required coding syncronized dialog . But once it works , users like it most. Worth a try if have enough resources.