Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
ThisObject (input) | LogicalOccurrence | Read
| The logical object placed in the schematic view. |
List_Zone_Categories (input) | List | Read | List of zone categories for the object retrieved from the diagram view. |
List_Zone_Names (input) | List | Read | List of names of the zones for the object retrieved from the diagram view. |
SpaceRefString (output) | String | Write | List of strings of corresponding space references to be queried for link creation. Note:
The wildcard character (*) must be added to the string, if needed.
|
List_Extension_Names | List of List String | Write | Names of customer extensions (such as Organizational_Deck, Organizational_FZ, Logical_Context) assigned to the space reference. |
List_Attr_Names | List of List String | Write | Names of attributes (such as Deck_ID, FZ_ID, LA) assigned to the space reference. If the customer extension name is empty for the corresponding attribute name and value, this attribute is considered as the reference attribute (and not an attribute on customer extension). |
List_Attr_Values | List of List Value | Write | Values of attributes (such as 7 for Deck_ID, 2 for FZ_ID, TRUE for LA) assigned to the space reference. If the customer extension name is empty for the corresponding attribute name and value, this attribute is considered as the reference attribute (not an attribute on customer extension). |
Note:
The List of List parameters are one to one mapping. Separate query is built for each list.
Samples
This first sample illustrates how a space reference is automatically linked with a logical
component. It also set the Description attribute on instances. The
Description attribute is set as following: The object is in ZoneCategory:ZoneName,
ZoneCategory:ZoneName, ZoneCategory:ZoneName.
/* CATRule signature (do not edit) : (ThisObject : #In LogicalOccurrence, Parameters : #In RuleContext) : #Void */
/* Sample rule*/
/* Input parameters are List of Zone Categories and List of Zone names*/
/* 1st Output parameter is a string by which we will search in database the space reference as Title*/
/* 2nd Output parameter is a ListOfList of Extension names which will be used to Build the Query (for reference attributes it will be empty string)*/
/* 3rd Output parameter is a ListOfList of Attribute names which will be used to Build the Query*/
/* 4th Output parameter is a ListOfList of Attribute values which will be used to Build the Query*/
/* All the ListOfLists are one to one mapping*/
/* Each List will be used to build a new query*/
/* Final No of spaces assigned will be addition of result of all queries*/
/* Assuming the values we get in List_Zone_Categories are "Decks" and "Fire Zones" */
/* Assuming the values we get in List_Zone_Names are as "Deck02" and "Firezone 03"*/
/* Assuming we have four extenions i.e. "Organizational_Deck", "Organizational_FZ" "Organizational_Deck_FZ" and "Logical_Context"*/
/* Organizational_Deck" extension has attribute as "Deck_ID"(Integer)*/
/* Organizational_FZ" extension has attribute as "FZ_ID"(Integer)*/
/* Organizational_Deck_FZ" extension has attributes as "Deck_ID"(Integer) and "FZ_ID"(Integer)*/
/* Logical_Context" extension has attribute as "LA"(Boolean)*/
/* So we will create 3 lists of extensions, 3 lists of attributes names and 3 list of attribute values*/
/* First list of Extensions names will contain "Organizational_Deck" and "Logical_Context" */
/* First list of attributes names will contain "Deck_ID" and "LA" */
/* First list of attributes values will contain 2(int) and true(Boolean) */
/* Second list of Extensions names will contain "Organizational_FZ" and "Logical_Context" */
/* Second list of attributes names will contain "FZ_ID" and "LA" */
/* Second list of attributes values will contain 3(int) and true(Boolean) */
/* Third list of Extensions names will contain "Organizational_Deck_FZ", "Organizational_Deck_FZ" and "Logical_Context" */
/* Third list of attributes names will contain "Deck_ID", "FZ_ID" and "LA" */
/* Third list of attributes values will contain 2(int), 3(int) and true(Boolean) */
/* In this sample rule, we return the output string as "*" */
/* First Query will be build as Find all Spaces which has Extension as "Organizational_Deck" and "Logical_Context" and "Deck_ID" value is 2 and "LA" value is true*/
/* Sexond Query will be build as Find all Spaces which has Extension as "Organizational_FZ" and "Logical_Context" and "FZ_ID" value is 3 and "LA" value is true*/
/* Third Query will be build as Find all Spaces which has Extension as "Organizational_Deck_FZ" and "Organizational_Deck_FZ" and "Logical_Context" and "Deck_ID" value is 2
and "FZ_ID" value is 3 and "LA" value is true*/
/* This rule is valid only for the data explained above */
/* User will have to modify this rule based on his/her Zone names, Zone Categories, Extensions names, Attribute names, Attibute values and Space References */
let This2DObject (LogicalOccurrence)
let ListZoneCategories(LIST)
let ListZoneNames(LIST)
set This2DObject = ThisObject
set ListZoneCategories = Parameters.GetAttributeObject ("List_Zone_Categories")
set ListZoneNames = Parameters.GetAttributeObject ("List_Zone_Names")
let OutputCENameListOfList(List)
let OutputCEAttrNameListOfList(List)
let OutputCEAttrValueListOfList(List)
Let attr_i(String)
Let i = 1
Let isize = 0
isize = ListZoneCategories->Size()
/* Get the values of Zone Categories*/
let OutputCEAttrNameLastList(List) /* Last List Of Attributes names*/
let OutputCEAttrValueLastList(List) /* Last List Of Attributes values*/
Let Customer_Ext(String) /* To create extension of type Organizational_Deck_FZ*/
/* We are running the loop only upto 2 values since the metadata we created for test had only "Deck" and "FZ" types of extensions*/
/* If user has something more like "Organizational_W.T.Comp" then he must run the loop upto size of ListZoneCategories*/
for i while i<=2
{
Let ZoneName(String)
Let CEAttrName(String)
set attr_i = ListZoneCategories->GetItem(i)
set ZoneName = ListZoneNames->GetItem(i)
if(attr_i == "Fire Zones")
{
set attr_i = "FZ"
set CEAttrName = "FZ_ID"
/* Below line is to remove the "Fire Zone" from "Fire Zone03" string which will be used for "FZ_ID" attribute value(ie 03)*/
set ZoneName = ReplaceSubText(ZoneName, "Fire Zone", "")
}
if(attr_i == "Decks")
{
set attr_i = "Deck"
set CEAttrName = "Deck_ID"
/* Below line is to remove the Deck from Deck02 string which will be used for "Deck_ID" attribute value(ie 02)*/
set ZoneName = ReplaceSubText(ZoneName, "Deck", "")
}
/* Below if else block will create Organizational_Deck_FZ string*/
if(i == 1)
{
set Customer_Ext = "Organizational_" + attr_i
}
else
{
set Customer_Ext = Customer_Ext + "_" + attr_i
}
set attr_i = "Organizational_" + attr_i
OutputCENameListOfList.Append(List(attr_i, "Logical_Context"))
OutputCEAttrNameListOfList.Append(List(CEAttrName, "LA"))
OutputCEAttrNameLastList.Append(CEAttrName)
Let ZoneID(Integer)
Let ZoneIDReal(Real)
set ZoneIDReal = ZoneName.ToReal()
set ZoneID = ZoneIDReal
OutputCEAttrValueListOfList.Append(List(ZoneID, TRUE))
OutputCEAttrValueLastList.Append(ZoneID)
i = i+1
}
OutputCEAttrNameLastList.Append("LA")
OutputCEAttrNameListOfList.Append(OutputCEAttrNameLastList)
OutputCEAttrValueLastList.Append(TRUE)
OutputCEAttrValueListOfList.Append(OutputCEAttrValueLastList)
/* Below code will append extension of Types Organizational_Deck_FZ in the last list of extension names*/
Let k = 1
let OutputCENameLastList(List) /* Last List Of Extensions names*/
/* We are running the loop only upto 2 values since the metadata we created for test had only "Deck" and "FZ" types of extensions*/
/* So in the last list of Extension names, we want to add two times "Organizational_Deck_FZ" and corresponding entries for attr names are "Deck_ID" and "FZ_ID" */
for k while k<=2
{
OutputCENameLastList.Append(Customer_Ext)
}
OutputCENameLastList.Append("Logical_Context")
OutputCENameListOfList.Append(OutputCENameLastList)
Let attr_j(String)
Let j = 1
Let jsize = 0
jsize = ListZoneNames->Size()
Let output_str(String)
set output_str = ""
/* Get the values of Zone names and create output string*/
/* Below code will create string as "Deck02_Firezone03" */
for j while j<=jsize
{
set attr_j = ListZoneNames->GetItem(j)
if(j < jsize)
{
set output_str = output_str + attr_j + "_"
}
else
{
set output_str = output_str + attr_j
}
j = j+1
}
/* We override the output_str as "*" to search by any name but with Extensions and Attributes */
/* If user wants to search from string as "Deck02_Firezone03", then comment the below line*/
set output_str = "*"
Parameters.SetAttributeString ("SpaceRefString", output_str)
Parameters.SetAttributeObject("List_Extension_Names", OutputCENameListOfList)
Parameters.SetAttributeObject("List_Attr_Names", OutputCEAttrNameListOfList)
Parameters.SetAttributeObject("List_Attr_Values", OutputCEAttrValueListOfList)