There are a number of actions that are available for most objects. These actions include Query, Create, Modify, Delete, and Undelete. Commands involving these actions inherit some common structure unique to the action type.
The Query action is used to query objects. It accept predicates that describe the attributes (fields) to return (including aggregation operations on those attributes), conditions that select which objects to return the attributes for, and other options unique to queries.
Selections use the Show option to specify a list of the attributes to return for the selected object. If selections are not specified, a default set of attributes (those not marked as hidden) will be returned.
Name = Show
Op = :=
Value = "attribute1,attribute2,attribute3,..."
Aggregation operators may be applied to attributes by enclosing the target attribute in parenthesis and prepending the name of the desired operator. The aggregation operators that can be applied depend on the datatype of the attribute.
Valid selection operators include:
Sort Ascending sort
Tros Descending sort
Count Count
Max Maximum value
Min Minimum value
Average Average value
Sum Sum
GroupBy Group other aggregations by this attribute
For example: Allocation Query Show:="Sum(Amount),GroupBy(Account)"
Conditions are used to select which objects the action is to be performed on.
Name = Name of the attribute to be tested
Op = conditional operator
Value = The object or value against which the attribute is tested
Valid condition operators include:
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
~ Matches
Matching uses the wildcards * and ? (equivalent to SQL % and _ respectively) in a manner similar to file globbing. * matches zero or more unspecified characters and ? matches exactly one unspecified character. For example mscf* matches objects having the specified attributes whose values start with the letters mscf, while mscf? matches objects having the specified attributes whose values start with mscf and have a total of exactly five characters.
Options indicate processing options that affect the result.
Name = Name of the option
Op = :=
Value = Value of the option
Valid options for query actions include:
ShowHidden:=True|False (False) Includes hidden attributes in the result
Time:="YYYY-MM-DD [hh:mm:ss]" Run the command as if it were the specified time
Unique:=True|False (False) Display only unique results (like DISTINCT in SQL)
Limit:={Integer Number} Limit the results to the number of objects specified
Example 7. Return the number of inactive reservations
gold> Reservation Query EndTime<now Show:="Count(Id)" Id --- 8
The Create action is used to create a new object. It accepts predicates that describe the values of the attributes to be set.
Assignments specify values to be assigned to attributes in the new object.
Name = Name of the attribute being assigned a value
Op = = (is assigned)
Value = The new value being assigned to the attribute
Example 8. Add a new project member
gold> ProjectUser Create Project=chemistry Name=scottmo Project Name Active Admin ------------- ---------- --------- ------- chemistry scottmo True False Successfully created 1 ProjectUser
The Modify action is used to modify existing objects. It accepts predicates that select which objects will be modified and predicates that describe the values of the attributes to be set.
Assignments specify values to be assigned to attributes in the selected objects.
Name = Name of the attribute being assigned a value
Op = assignment operators {=, +=, -=}
Value = The value being assigned to the attribute
Valid assignment operators include:
= is assigned
+= is incremented by
-= is decremented by
Conditions are used to select which objects the action is to be performed on.
Name = Name of the attribute to be tested
Op = conditional operator
Value = The object or value against which the attribute is tested
Valid condition operators include:
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
~ Matches
Matching uses the wildcards * and ? (equivalent to SQL % and _ respectively) in a manner similar to file globbing. * matches zero or more unspecified characters and ? matches exactly one unspecified character. For example mscf* matches objects having the specified attributes whose values start with the letters mscf, while mscf? matches objects having the specified attributes whose values start with mscf and have a total of exactly five characters.
Example 9. Change/set scottmo phone number and email address
gold> User Modify Name==scottmo PhoneNumber="(509) 376-2204" EmailAddress="Scott.Jackson@pnl.gov" Name Active CommonName PhoneNumber EmailAddress DefaultProject Description ---------- --------- ------------------------- --------------------- ------------------------------- --------------------- ---------------- scottmo True Jackson, Scott M. (509) 376-2204 Scott.Jackson@pnl.gov Successfully modified 1 Users
Example 10. Extend all reservations against project chemistry by 10 days
gold> Reservation Modify EndTime+="10 days" Project==chemistry Id Account Amount Name Job User Project Machine EndTime Description --- ---------- --------- --------------- ---- ------ ------------- ---------- ---------------------------- ---------------- 1 2 57600 PBS.1234.0 1 amy chemistry colony 2004-11-06 10:47:30 Successfully modified 1 Reservations
The Delete action is used to delete objects. It accepts predicates that select which objects are to be deleted.
Conditions are used to select which objects the action is to be performed on.
Name = Name of the attribute to be tested
Op = conditional operator
Value = The object or value against which the attribute is tested
Valid condition operators include:
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
~ Matches
Matching uses the wildcards * and ? (equivalent to SQL % and _ respectively) in a manner similar to file globbing. * matches zero or more unspecified characters and ? matches exactly one unspecified character. For example mscf* matches objects having the specified attributes whose values start with the letters mscf, while mscf? matches objects having the specified attributes whose values start with mscf and have a total of exactly five characters.
Example 11. Get rid of the pesky Jacksons
gold> User Delete CommonName~"Jackson*" Name Active CommonName PhoneNumber EmailAddress DefaultProject Description ---------- --------- ------------------------- --------------------- ------------------------------- --------------------- ---------------- scottmo True Jackson, Scott M. (509) 376-2204 Scott.Jackson@pnl.gov Successfully deleted 1 Users and 1 associations
The Delete action is used to restore deleted objects. It accepts predicates that select which objects are to be undeleted.
Conditions are used to select which objects the action is to be performed on.
Name = Name of the attribute to be tested
Op = conditional operator
Value = The object or value against which the attribute is tested
Valid condition operators include:
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
~ Matches
Matching uses the wildcards * and ? (equivalent to SQL % and _ respectively) in a manner similar to file globbing. * matches zero or more unspecified characters and ? matches exactly one unspecified character. For example mscf* matches objects having the specified attributes whose values start with the letters mscf, while mscf? matches objects having the specified attributes whose values start with mscf and have a total of exactly five characters.
Example 12. Resurrect the deleted users that were active
gold> User Undelete Active==True Name Active CommonName PhoneNumber EmailAddress DefaultProject Description ---------- --------- ------------------------- --------------------- ------------------------------- --------------------- ---------------- scottmo True Jackson, Scott M. (509) 376-2204 Scott.Jackson@pnl.gov Successfully undeleted 1 Users and 1 associations