Using the Gosu scratchpad
Use the Gosu scratchpad to execute Gosu programs and evaluate Gosu expressions. Instead of needing to perform PolicyCenter operations to trigger your Gosu code, you can run your code directly in the Scratchpad and see immediate results.
Run the Gosu scratchpad
Before you begin
To execute queries against the database in Studio or the Gosu scratchpad, you must first connect to a running application server.
About this task
The result of a query is always a read-only query object. To work with this read-only object, you must add it to a transaction bundle.
You can test the following in the Gosu scratchpad:
Code |
Description |
|---|---|
Expression |
Returns the result of evaluating the (single-line) expression. |
Program |
Displays the output
of the program, including calls to |
- To run the Gosu scratchpad, click
.
Executing code in the Gosu scratchpad
Procedure
Accessing application data in the Gosu scratchpad
You can always use the Gosu scratchpad to test generic Gosu code. If the scratchpad code needs to access application data, then the PolicyCenter server must be running in debug mode. For example, the following code accesses group and user entities, and therefore requires access to the application server:
var group : Group = Group(2)
for (var member in group.Members) {
print(member.User.Contact.LastName)
}
To access application data in the Gosu scratchpad, run the PolicyCenter server in debug mode, and then instruct the scratchpad to run your code in that process. The DCEVM must be installed on the server. For information on running the PolicyCenter server in debug mode, see Testing PolicyCenter with Guidewire Studio.
See also
