Home > System Defined Functions Reference > Resource Functions

Resource Functions

Function

Description

Syntax

.EQ

.GE

.GT

.LE

.LT

.NE

Returns the resource ID of a transaction’s acquired resource based on comparison with a resource attribute.

These functions are only valid when they appear immediately after a resource attribute in an expression. For example, you can specify R.x.EQ(0) in an expression only if you have defined the resource attribute R.x.

The resources are inspected in AcqResId() order. These functions specify a series of tests to be applied. The resource id that passes all of the tests is returned.

Value specifies the value to be compared to the resource’s R.x if Index is omitted, else R.x[Index].

Path1 and Path2, if specified and non-null, are resource paths that are matched to the resource ID and must be found or not found depending on the values of Find1 and Find2, respectively. Paths are considered found if DelimitedFind(id,path,”/@”)>=0.

If Count is 1, the ID of the first acquired resource that passes the tests is returned; if it is two, then the second, and so on. If Count is negative, the resources are inspected in reverse acquired order.

If none of the resources pass the tests, the null string is returned:

.EQ is R.x or R.x[Index] = Value
.GT is R.x or R.x[Index] > Value
.LT is R.x or R.x[Index] < Value
.GE is R.x or R.x[Index] >= Value
.LE is R.x or R.x[Index] >= Value
.NE is R.x or R.x[Index] != Value

.EQ[Value,[Count=1],[Path1],[Find1=True],[Path2],[Find2=True],[Index])

Examples

R.x.op(v,n)!=””
is true if a transaction has acquired at least n resources (n>=1; n defaulting to 1) where (R.x op v) is true. For example:

R.Skill.GT(5) != ““
true if at least one resource with a Skill > 5 has been acquired

R.Skill.GT(5,n) !=””
true if at least n resources with a Skill>5 have been acquired

R.Skill[R.Skill.GT(5,n)]
returns the value of the (n)th Skill>5

See also IsEmpty for more examples.

 

 

 

.Min

.Max

Returns a resource ID of a transaction’s acquired resource based on the minimum or maximum value of a resource attribute.

The resources are inspected in AcqResId() order. These functions specify a series of tests to be applied. The resource id that passes all of the tests is returned.

The values that are inspected are R.x if Index is omitted, else R.x[Index].

Path1 and Path2, if specified and non-null, are resource paths that are matched to the resource ID and must be found or not found depending on the values of Find1 and Find2, respectively. Paths are considered found if DelimitedFind(id,path,"/@”)>=0.

If Count is 1, then the ID of the first acquired resource with the smallest (or largest) value that passes the tests is returned, if it is 2, then the second most smallest (or largest) is returned, and so on. If Count is negative, the resources are inspected in reverse acquired order.

If not enough resources pass the test, the null string is returned.

.Min[[Count=1],[Path1],[Find1=True],[Path2],[Find2=True],[Index])

AcqFromResId

While all Resource functions that include Path parameters inspect the swimlane path from which a resource was acquired, all Resource functions, with the exception of AcqFromResId, return a resource ID containing the current swimlane path. AcqFromResId searches the acquired resources for one which has a resource path that matches the resource path of its ResId parameter. If found, that resource ID with the swimlane path the resource was acquired from is returned, else the null string is returned.

AcqFromResId(ResId)

AcqResCount

Returns an integer representing the number of resources a transaction has acquired that pass some optional test. Path1 and Path2, if specified and non-null, are resource paths that are matched to the resource ID and must be found or not found depending on the values of Find1 and Find2, respectively. Paths are considered found if DelimitedFind(id,path,”/@”)>=0.

AcqResCount()[[Path1],[Find1=True],[Path2],[Find2=True])

AcqResId

Returns the resource ID of one of a transaction’s acquired resources.

If both Path1 and Path2 are unspecified or are null, then the ID of the acquired resource as specified by Index is returned. It is an error if Index exceeds the number of acquired resources.

If either Path1 or Path2 is specified and non-null, the resources are inspected in AcqResId() order and a series of tests are applied. The resource id that passes all of the tests is returned.

Path1 and Path2, if specified and non-null, are resource paths which are matched to the resource id and must be found or not found depending on the values of Find1 and Find2, respectively. Paths are considered found if DelimitedFind(id,path,”/@”)>=0.

If Index is 1, then the first ID that matches the paths is returned, if it is 2, then the second, and so on. If Count is negative, the resources are inspected in reverse acquired order.

If not enough resource IDs pass the test, the null string is returned.

It is an error if both Path1 and Path2 are omitted and Index is out of bounds.

AcqResId(Index,[Path1],[Find1=True],[Path2],[Find2=True])

ResId

If Value is omitted, this function is only valid if the transaction has acquired exactly one resource, in which case the resource ID of that resource is returned. If Value is specified, it is caste to a resource ID for use as the first index of a Resource attribute.

If value is omitted within resource acquisition constraint expressions, ResId() is evaluated in the context of each available resource.

For more information, see Arrays in iGrafx, Activity and Resource Attributes in Array Indices, and Specify a Resource Acquisition Constraint.

ResId([Value])

Related Topics

System Defined Functions Reference