rajeev2012
28th November 2006, 08:59
Hi,
I am having an issue while importing a variable from calling session. The variable has been declared as EXTERN in both sessions (Calling and Called). The weired thing is, the same code is working with all other sessions. Hence, I would like to know, if there is any setting do exist to suppress IMPORT/EXPORT instructions.
Note: I have also tried get.var() and put.var() functions.
-Rajeev
ARijke
28th November 2006, 09:13
No there is not such a setting. The variable needs only to be extern in the calling session.
You tried the right things. Maybe a simple thing is preventing it.
- is the declaration done before the import (in both scripts)
- did you use the same domain?
Regards, Adriaan
george7a
28th November 2006, 11:41
Hi,
Please share your code (both sessions), you might get more help then.
- George
rajeev2012
28th November 2006, 15:10
Please find below my code
Calling Program:
extern domain tcseak search
before.program:
import("search",search)
I have also tried in zoom session
zoom.from.all:
on.entry:
import("search",search)
Called Program:
extern domain tcseak search
field.tssoc210.otbp.c:
before.zoom:
search = tssoc210.otbp.c
I have tried with export command, too
george7a
28th November 2006, 15:17
As I understand you are mixing them up. The "called" program is the one who should do the import.
Example: if session1 is zooming to session2. session2 should import the variable.
Also import (& get.var) should returns 1 for success and 0 for error. Make sure you check that.
I hope it helps,
- George
joepte
2nd April 2012, 20:22
Hi,
I am not sure if this should be a new thread but for the sessions I am currently working on I have a problem in that when I zoom.to$ the session it does not go to the zoo.from.all section rather it goes to the field section in the called session.
Could it be the called session's Start Option? (6 - Find) - should it not go to the zoom.from.all in the called session after a zoom.to$
(N.B.: Baan IVc4; both sessions are custom and thus I have the scripts)
Thansk for any help
*********choice section in calling session ********
choice.user.2:
n.choice:
|export("variable.in.calling", variable.in.called)
export("tdltc904.item", tdltc902.item)
export("tdltc904.clot", tdltc902.clot)
zoom.to$("tdltcc920m000",z.session,"","",0)
**********zoom section in called session *********
zoom.from.all:
on.entry:
check.imp1 = import("tdltc902.item",tdltc902.item)
check.imp2 = import("tdltc902.clot",tdltc902.clot)
execute(find.data)
mark_h
2nd April 2012, 21:53
Try giving the zoom.to$ a zoom name in 3rd parameter. See if that does it.
bdittmar
3rd April 2012, 00:09
Hello,
from progguide :
BaanERP Programmers Guide
zoom.to$()
--------------------------------------------------------------------------------
Syntax
string zoom.to$( string process(14), long zoomcode, string zoomname(18), string returnfld(18), long formpos )
Description
Use this to zoom to another session or menu.
Arguments
process
Specifies the name of the session or menu that must be started.
zoomcode
This can be either Z.MENU or Z.SESSION, depending on whether it is a menu or session that is being started.
zoomname
The name of the calling process. This is used in the zoom.from sections in the called process. If no name is provided here, zoom.from sections in the child session are not executed.
returnfld
Indicates the name of the variable to be returned by the function. It must be the name of a variable in the called process. If an empty string is specified here, the function returns the exit value of the zoom process. If the argument is not filled, the function returns nothing.
formpos
Specifies the form position for displaying the window. The default is 0
Note
This function is supported for backward compatibility only. In new applications, use start.session() instead.
Return value
The variable specified in the returnfld argument.
Context
Bshell function.
Use this function only in combination with the 4GL engine.
Regards
BaanInOhio
3rd April 2012, 05:42
Baan IVc4; both sessions are custom and thus I have the scripts
*********choice section in calling session ********
choice.user.2:
n.choice:
|export("variable.in.calling", variable.in.called)
export("tdltc904.item", tdltc902.item)
export("tdltc904.clot", tdltc902.clot)
zoom.to$("tdltcc920m000",z.session,"","",0)
**********zoom section in called session *********
zoom.from.all:
on.entry:
check.imp1 = import("tdltc902.item",tdltc902.item)
check.imp2 = import("tdltc902.clot",tdltc902.clot)
execute(find.data)
You don't have to do both the import and export. One is fine. I always try to do imports in the called session if possible since you know that both caller and called sessions are active at the time of the import. I also do any returned variables using export from the called session. In your example, I would simply do (only) the zoom.to$ in the caller then import the variables in the called (zoomed) session. I have seen issues with exporting from the caller before calling the zoom when the main table of the caller includes the fields that are being exported. If the main table of the called session is the same as the exported variables, you can simply fill the variables and let the imports happen automatically with the zoom.to$. This is commonly done when calling sessions for 'tcmcs' tables.
joepte
3rd April 2012, 15:43
Thanks for the responses.
I am still not clear if the called program will start on the zoom.from.all section rather
the field section in the called session. The called session start.option = 6 find; has the zoom.from.all already been read but that time? it doesn't look like it.
Regards...
mark_h
3rd April 2012, 16:00
Your best bet is to put the called session in debug mode and watch it step through what is called when. You could try the zoom.to with and with out a zoom name to see what happens. Below is a sample from some of our code:
Calling program has this:
export("po.work",po.work)
export("po.line",po.line)
export("pgc9122.abort",pgc9122.abort)
dummy = zoom.to$("tipgc9122s000",z.session,"","",0)
Called program has this:
before.program:
import("po.work",po.work)
import("po.line",po.line)
import("pgc9122.abort",pgc9122.abort)
Hitesh Shah
6th April 2012, 19:41
Just for record export statement in calling session before zoom.to$ is redundant in called / zoomed session . You can work without such export statement .
fallguyjg
17th April 2012, 18:27
My understanding is that the IMPORT/EXPORT statements are placed in the child session pointing to the extern variables in the parent session.
fallguyjg