Target system computed columns - SmartPlant Foundation - IM Update 46 - Help - Hexagon

SmartPlant Foundation Help

Language
English
Product
SmartPlant Foundation
Search by Category
Help
SmartPlant Foundation / SDx Version
10
SmartPlant Markup Plus Version
10.0 (2019)
Smart Review Version
2020 (15.0)

The following computed columns use information from the target system so that the computed columns conforms to the target system.

GetDocumentRevisionsCountFromTargetSystem

This computed column retrieves the number of revisions available for a document from the target system. It uses these parameters:

QueryDef – Used to uniquely identify the document master in the target system. You can specify the class definition of the document master and the document name.

IgnoreConfiguration - Used to specify whether to include all configurations in the query or not.

  • This QueryDef searches for class definitions that realize the interface ISPFDocumentMaster.

  • If more than one document is identified by the QueryDef, then a cumulative count of all the revisions available for the identified documents is returned.

Example

In this example, the first parameter finds the object with the class definition SPFDesignDocMaster and name Document1. The second parameter searches in all configurations.

func.GetDocumentRevisionCountFromTargetSystem(“#SPFDesignDocMaster,.Name=’Document1’”,"true")

Scenario

To configure a rule that would result in a validation failure message for a document having more than one version, do the following:

  • Create an integer rule with minimum value set as zero and maximum value set as one. The Allow Blank Values option should be set to True.

  • Create a computed column with the following function:

    func.TrimStart(func.GetDocumentRevisionsCountFromTargetSystem("#SPFDesignDocMaster,.Name=[DOCUMENT_NUMBER]","True"),"0")

GetMajorRevisionCodeFromTargetSystem

Given a revision scheme and a revision code, the computed column retrieves the details for the revision scheme from the target system, then splits the major revision code and validates that it conforms to the criteria for the revision code.

For example,

func.GetMinorRevisionCodeFromTargetSystem([REVISION_SCHEME], [REVISION_CODE])

func.GetMajorRevisionCodeFromTargetSystem([REVISION_SCHEME], [REVISION_CODE])

GetMinorRevisionCodeFromTargetSystem

Given a revision scheme and a revision code, the computed column retrieves the details for the revision scheme from the target system, then splits the minor revision code and validates that it conforms to the criteria for the revision code.

Errors

If an error occurs in either computed columns, the system displays the following error message:

ERROR resolving MINOR/MAJOR revision code REV_CODE using revision scheme REV_SCHEME

This error is not used for any .Net exceptions. This error occurs when either the computed column produces an empty value, both the minor and sequences are numeric, or both the sequences are alphabetic.

For example:

func.GetMajorRevisionCodeFromTargetSystem("RS_REV01", "A1") = A

func.GetMinorRevisionCodeFromTargetSystem("RS_REV01", "A1") = 1

GetTargetSystemValueIfEmptyReturnDefault

This computed column retrieves the value of a property from the target system, and if the object specified by the QueryDef is not found in the target system, returns the default value specified in the input string. It uses the following parameters:

IncludeHigherConfiguration – Used to specify whether to include a higher configuration in the query or not.

Default value – Used to specify the default value if the object specified by the QueryDef is not found in the target system.

QueryDef – Used to find an object in the target system. You can specify the class definition of the object and any property values found on that object or a related object. Any number of criteria can be added by separating them with a comma. This parameter must be a constant string, but it can reference other columns within the string if you enclose each of those columns in brackets [ ]. For example, func.Concat({[TestColumn1], [TestColumn2], [TestColumn3]}).

ReturnDef - Used to describe the property to be returned from the target system. You can specify the relationships to which to navigate, followed by the property you want to retrieve. Any number of relationships can be navigated. This parameter must be a constant string.

  • You must use the target system schema in the QueryDef and ReturnDef.

  • If multiple objects are found, either by the QueryDef or by navigating to the relationships, then multiple values are returned, each separated by a comma.

Example 1

In this example, the first parameter specifies whether to include items from a higher configuration or not. The second parameter specifies the default value to be returned if the object specified by the QueryDef is not found in the target system. The third parameter is specified to find the object with the class definition SPFDesignDocMaster and the UID Document1. The fourth parameter specifies to return the description of that object.

func.GetTargetSystemValueIfEmptyReturnDefault("false","This is default document master description","#SPFDesignDocMaster,.UID='Document1'", ".Description")

Example 2

In this example, the same object is navigated using the SPFPrimaryClassification relationship from end 2 to end 1 to find the required UID property. If the object specified by the QueryDef is not found in the target system, then the default string, "Object is not found", is returned.

func.GetTargetSystemValueIfEmptyReturnDefault("false","Object is not found","#SPFDesignDocMaster,.UID='Document1'","-SPFPrimaryClassification.UID")

Example 3

In this example, a match on the name is used to find the object, instead of the UID. The name DOCMASTER_NAME is used to match on from the column, instead of entering it manually. If the object is not found, then the default string, "Object is not found", is returned.

func.GetTargetSystemValueIfEmptyReturnDefault("false","Object is not found","#SPFDesignDocMaster,.Name=[DOCMASTER_NAME]","-SPFPrimaryClassification.UID")

Example 4

This example shows how multiple relationships can be navigated. -RelDef1+RelDef2.Name navigates RelDef1 from end2 to end1, and RelDef2 from end 1 to end 2. This returns the object name from the end of those relationships. If the object is not found, then the specified default string value is returned.

func.GetTargetSystemValueIfEmptyReturnDefault("false","Folder1 is not found","#SPFFolder,.Name='Folder1'","-SPFFolderDocumentVersion+SPFFolderSupportItem.Name")

GetValueFromTargetSystem

This computed column retrieves the value of a property from the target system. It uses the following parameters:

IncludeHigherConfiguration – Used to specify whether to include a higher configuration in the query or not.

QueryDef – Used to find an object in the target system. You can specify the class definition of the object and any property values found on that object or a related object. Any number of criteria can be added by separating them with a comma. This parameter must be a constant string, but it can reference other columns within the string if you enclose each of those columns in brackets [ ]. For example, func.Concat({[TestColumn1], [TestColumn2], [TestColumn3]}). If the object is not found in the target system, then "NULL" value is returned.

ReturnDef - Used to describe the property to be returned from the target system. You can specify the relationships to navigate to, followed by the property you want to retrieve. Any number of relationships can be navigated. This parameter must be a constant string.

  • You must use the target system schema in the QueryDef and ReturnDef.

  • If multiple objects are found either by the QueryDef or by navigating to the relationships, then multiple values are returned, each separated by a comma.

Example 1

In this example, the first parameter specifies items at a higher configuration or not. The second parameter is specified to find the object with the class definition SPFDesignDocMaster and the UID Document1. The third parameter specifies to return the Name of that object.

func.GetValueFromTargetSystem("false", "#SPFDesignDocMaster,.UID='Document1'", ".Name")

Example 2

In this example, the same object is navigated using the SPFPrimaryClassification relationship from end 2 to end 1 to find the required UID property.

func.GetValueFromTargetSystem("false","#SPFDesignDocMaster,.UID='Document1'","-SPFPrimaryClassification.UID")

Example 3

In this example, a match on the name is used to find the object, instead of the UID. The name DOCMASTER_NAME is used to match on from the column, instead of entering it manually.

func.GetValueFromTargetSystem("false", "#SPFDesignDocMaster,.Name=[DOCMASTER_NAME]", "-SPFPrimaryClassification.UID")

Example 4

This example shows how multiple relationships can be navigated. -RelDef1+RelDef2.Name navigates RelDef1 from end2 to end1, and RelDef2 from end 1 to end 2. This returns the object name from the end of those relationships. If the object is not found, then the value, "NULL" is returned.

func.GetValueFromTargetSystem("false", "#SPFFolder,.Name='Folder1'", "-SPFFolderDocumentVersion+SPFFolderSupportItem.Name")