lauras
10th February 2004, 20:17
I have a session that needs to zoom to different sessions depending on the main "type" value. One of the sessions zoomed to returns a number instead of a string. I have entered 'on.exit' logic in the zoomed-to session to change the value to a string, but when the zoom returns, I still get an error because "expecting STRING".
I have tried putting a statement in the after.zoom to convert to string, that doesn't work either. How do I set the return value to a variable? I don't see a predefined variable for that. There are predefined variables for the zoom session, the zoom return field (meaning the table.field name of what will be returned), and the attribute variables. I don't see a variable that holds the value when returning from the zoom.
dorleta
11th February 2004, 12:36
The standar solution.
function extern long tgwms0004.start.application(const string application(),
const string arguments (),
domain tgyenox local,
long mode,
[long pop_up])
{
DLLUSAGE
This function starts the application with the given arguments. The given
application may not be empty, the arguments may be empty.
Parameters:
application the application which must be started
arguments the arguments with which the application will be started
local if tgyenox.yes then the application will be started on the
local machine, otherwise it will be started on the server.
Note that only on BW the tgyenox.yes should be used, in which
case a: "create.object(DsCapplication, 0, ...)" will be done.
In all other cases either a "shell()" or "run.prog()" will be
done depending on the current Baan version.
This function does NOT check whether the current platform is BW.
mode the mode needed for "shell()" or "run.prog()"
pop_up whether (if true) or not (if false) pop-ups on errors must be
given. Default is: false.
Return value:
= 0 successful completion, application started
< 0 some error occurred
-------------------------------------------------------------------------------
ENDDLLUSAGE
lauras
11th February 2004, 16:25
I don't understand the reply to my original post. I'm not calling an outside application, and even if I was, I don't have enough information to know how/when to use this function. If it's a function that would return a string value, I would need to know where to use it, and how. Use it in the zoom from session or the zoom to session? It just doesn't make sense to me.:confused:
francishsu
11th February 2004, 16:47
It'd be helpful if you could post the zoom.to$ statement from the parent session and the code from the child session related to the variable you are trying to return on the parent.
That being said..
Personally, I like to use the import()/export() functions to "pass" values between parent and child. Using import and export, there's no need to worry about converting to string and you can copy multiple variable values this way.
Basically works as follows:
Parent session
declare variables to be made available to the child as extern
execute the zoom.to$ function to execute the child session
Child session
declare variables for holding the values that will be imported from the parent session and exported to the parent
create the appropriate zoom.from section with import/export code
e.g.
zoom.from.<parent zoom.to$ argument>:
on.enter:
import("<parent variable name 1>", <child variable 1>)
import("<parent variable name 2>", <child variable 2>)
etc.
on.exit:
export("<parent variable name A>", <child variable A>)
export("<parent variable name B>", <child variable B>)
etc.
lauras
11th February 2004, 17:06
I'll paste in the code after a comment or two. This zoom is on a field, so my options are limited to before.zoom and after.zoom in the calling session (as far as I know). I don't actually code the zoom.to$ statement, I'm modifying the attribute variables to change where the zoom goes.
first session, field user zooms from -
field.tcmcs960.bans:
before.checks:
tcmcs960.bans = toupper$(tcmcs960.bans)
display("tcmcs960.bans")
check.input:
verify.input()
set.ftyp()
before.zoom:
set.zoom.fields() {defines zoomsession and zoomreturn}
zoomfield$ = "tcmcs960.bans"
zoomreturn$ = "ret.field"
attr.zoomsession$ = z.sess
attr.zoomreturn$ = z.fld
attr.zoomcode = z.session + z.autoaccept
after.zoom:
import("tcmcs960.bans",ret.field)
(I've tried a bunch of different things, this is the current version)
second session, zoom logic -
zoom.from.tcmcs960.bans:
on.exit:
zoom.field = str$(tccom001.emno)
export("tcmcs960.bans",zoom.field)
I hope that clears up what I'm doing, maybe someone can help!
Thanks.
dorleta
12th February 2004, 10:00
Sorry this reply is for another question about use external programs in baan . Excuse me.