« Back to University of Vienna - OMILAB

PROCEDURE without ITEM error

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
PROCEDURE without ITEM error
Answer
9/22/14 1:48 PM
Hi,

I am trying to add a generic procedure to the External Coupling.
However if i add the AdoScript code, the platform throws the error "PROCEDURE without ITEM".
How is it possible to simply add procedures without coupling them to a menu item?

Thank you very much!

RE: PROCEDURE without ITEM error
Answer
9/23/14 5:29 AM as a reply to Anonymous.
Dear UNIVIE Team,

to add an AdoScript PROCEDURE in your implementation, you need to load the AdoScript that holds the procedure to make it locally or globally available. This can happen on a menu item or on an event (see the section on AdoScript Triggers on the Documentation page for all possibilities).

To make a PROCEDURE implementation globally available, I would propose you add the PROCEDURE in the event "AppInitialized", loading the implementation during startup. The example below shows how to open an output windows during the initialization and provide a globale procedure to log information to that window.
 1
 2ON_EVENT "AppInitialized" {
 3  # create the dockable window for the output stream
 4  CC "AdoScript" CREATE_OUTPUT_WIN winid:"EVENTLOG" title:"Event Logging"
 5
 6  # load a global procedure as a helper implementation for timestamped logging
 7  PROCEDURE global EVENT_LOG msgType:string message:string {
 8    CC "Application" GET_DATE_TIME date-format:"dd/mm/yyyy" time-format:"hh:mm:ss"
 9    SET currentDateTime: ((date) + " " + (time))
10    CC "AdoScript" OUT winid:"EVENTLOG" text: ("[" + (msgType) + "@" + currentDateTime + "]: " + (message) + "\n")
11  }
12}
13
14# Call the procedure anywhere in your AdoScript implementation
15# ...
16EVENT_LOG msgType:"EVENT_LOG" message: ("AppInitialized")

RE: PROCEDURE without ITEM error
Answer
9/23/14 6:12 AM as a reply to Wilfrid Utz.
Thank you.
I would have liked to add procedures without having to define them within an event or a menu item but your answer suggest that this is not possible (anymore)?