Documente Academic
Documente Profesional
Documente Cultură
1.2: Statements
Variables, declaring
var variableName : dataType
var variableName = initial_value
Comments (single-line)
// comment
Comments (multiple-line)
/* comment
*/
Statements
(no need to terminate statements with any character, such as a ";")
Conditions
Gosu recognizes both AND and &&
Gosu recognizes both OR and ||
Gosu recognizes both NOT and !
Keep in mind that = and == are different
variable = value // value is assigned to variable
variable == value // returns true if var equals value
To test for nulls, use: == null
String concatenation
value + value
If/else
if ( condition )
statement_or_{ block }
else
statement_or_{ block }
Ternary operator
condition ? returnValueIfTrue : returnValueIfFalse
// parentheses not required around condition but often
// added to improve readability
Library functions
gw.api.util.DateUtil.FunctionName(arguments)
gw.api.util.StringUtil.FunctionName(arguments)
gw.api.util.MathUtil.FunctionName(arguments)
1.3: Objects
Objects, declare
var objectName = new datatype()
Sorting results
resultsObj.orderBy(\row -> row.FieldName)
resultsObj.orderByDescending(\row -> row.FieldName)
Querying when only one result is expected
queryObj.select().AtMostOneRow
3.3: Subqueries
Associating subquery to parent query
parentQuery.subselect("fieldInParentQuery",
operator, childQuery, "fieldInChildQuery")
Lessons 4 And Beyond
4: Business Rules
(There is no new syntax discussed in detail in this lesson.)
5: PCF functions
Declaring PCF function
function functName (inputvar : datatype) : returnType {
// code to execute function
return returnValue
}
Setters
property set PropertyName( parameter : dataType ) {
// code to set appropriate property, using "this" to
// reference root object
}
Functions
function functionName(parameter : dataType) : returnType {
// code to execute function,
using "this" to reference root object
return returnValue
}
7: Script Parameters
Referencing script parameters
ScriptParameters.parameterName
http://www.allinterview.com/mypanel.php?ap
OR
http://www.allinterview.com/search.php?q=Guidewire&company=&go=Search