CollectionMember

  • Updated

Runtime representation of a Collection Member.

getField(fieldName) Returns: Field

Parameters:

fieldName

Type: string

The name of the Field to return

Description:

Attempts to get a child Field from the CollectionMember instance. Only can be used with Entity and Complex fields.

Code Sample:

var session = inrule.createRuleSession();
var entity1 = session.createEntity("Entity1");
var collection = entity1.getCollection("Collection1"); 
var collectionMember = collection[0]; var field = collectionMember.getField("Field1");

 

getCollection(collection Name) Returns: Collection

Parameters:

collectionName

Type: string

The name of the Collection to return

Description:

Attempts to get a child collection from the CollectionMember instance. Only can be used with Entity and Complex fields.

Code Sample:

var session = inrule.createRuleSession();
var entity1 = session.createEntity("Entity1");
var collection = entity1.getCollection("Collection1"); 
var collectionMember = collection[0]; var childCollection = collectionMember.getCollection("ChildCollection1");

 

getValue() Returns: object

Description:

Returns the object bound to the current CollectionMember

Code Sample:

var session = inrule.createRuleSession();
var boundValue = {"Collection1": [{"FirstName": "John"}]}; 
var collection = entity1.getCollection("Collection1");
var collectionMember = collection[0]; var collectionMemberValue = collectionMember.getValue(); // collectionMemberValue is equal to the boundValue.Collection1[0]

 

getName() Returns: string

Description:

Returns a string of the CollectionMember's name

Code Sample:

var session = inrule.createRuleSession();
var entity1 = session.createEntity("Entity1");
var collection = entity1.getCollection("Collection1"); 
// Assume Collection1 is a Collection of "Entity2" var collectionMember = collection[0]; var collectionMemberName = collectionMember.getName();
// collectionMemberName is "Entity2";

 

metadata Returns: AuthoringMetadata

Description:

Returns an AuthoringMetadata object for the CollectionMember

Code Sample:

var session = inrule.createRuleSession();
var entity1 = session.createEntity("Entity1");
var collection = entity1.getCollection("Collection1"); 
var collectionMember = collection[0]; var displayName = collectionMember.metadata.displayName;

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.