Andy..
4th January 2007, 16:28
I have added api.mode into a report script, but it won't compile. Error is:
api.mode not declared

Another thread suggested adding : #pragma used dll "ottstpapihand"
but that hasn't worked. Looking in std session program scripts it looks like that variable should be available as standard. Has anyone done this within a report script?

Thanks

Chematrix
4th January 2007, 16:49
In 4GL scripts, the predefined variable api.mode is present to know whether
the session is started by the AFS. If different behavior is needed for sessions
that run in API-mode and sessions with a normal user-interface, this variable
must be used.
If the variable api.mode is used in a DLL, it must be declared in the dll as
extern long otherwise it will cause compile errors.

mark_h
4th January 2007, 16:58
No - but I did have to declare it in a dll.

extern domain tcbool api.mode

As Chematrix recommended you probably just need to declare as external.

Andy..
4th January 2007, 17:41
thanks for your swift reply - the problem I have here is trying to use api.mode within a report script. It doesn't compile if I just add 'api.mode' into the code.

I just tried adding the declaration mentioned above which obviously gets around the report compilation problem - however the variable remains unset when in api mode! So I still can't see from the report script code whether it is being run through std session or API :(

george7a
4th January 2007, 18:12
Hi,

Try to import api.mode variable using the import function:
http://www.baanboard.com/programmers_manual_baanerp_help_functions_variables_interprocess_transfer_import

- George

Chematrix
4th January 2007, 18:22
Transfer the api.mode to the report like parameter..

Hitesh Shah
6th January 2007, 16:43
As api.mode is a static para , u may transfer the same by using the import statement rather than as an input variable . This will also work in before.program of report and will remain there throughout the report run .

Andy..
10th January 2007, 18:44
import function worked a treat - thanks guys :)