Computed columns for returning the latest revision of a document - SmartPlant Foundation - IM Update 48 - 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)

Example

Scenario: The objective is to return the latest revision of a document using Data Validator functions in computed columns.

The following example considers only the working document or the current document (if no working document is available) as the latest revision. If you have created custom revision states for your documents, you must ensure that you modify the computed columns accordingly with the latest revision state information.

  • If a working document is available for a document master, it must be considered as the latest revision. If a working document is not available, the current document must be considered as the latest revision.

  • The computed columns, COMP_GetLatestWorkingDocRevisionUID, COMP_GetLatestCurrentDocRevisionUID, and COMP_CheckIfOnlyWorkingDocExists are used to find out if only a current document is available or if both current and working documents are available. If both documents are available, the working document is treated as the latest revision.

DocMasterName - The column header that contains the Document Master name for all revisions. This column can be a physical column with the document name available in the CSV file or a computed/constant column which holds the name of the document. For this example, the SPFDesignDocumentMaster class definition is used. You can replace it with the required class definition.

COMP_GetLatestWorkingDocRevisionUID - This function will return a working revision of the document, if available. If no working revision is available, no output is returned.

func.GetTargetSystemValueIfEmptyReturnDefault("False", "", "#SPFDesignDocumentMaster,.Name=[COMP_DocMasterName],+SPFDocumentRevisions.SPFRevState='e1WORKING'", "+SPFDocumentRevisions.UID")

COMP_GetLatestCurrentDocRevisionUID - This function will return a current revision of the document, if available. If no current revision is available, no output is returned.

func.GetTargetSystemValueIfEmptyReturnDefault("False", "", "#SPFDesignDocumentMaster,.Name=[COMP_DocMasterName],+SPFDocumentRevisions.SPFRevState='e1CURRENT'", "+SPFDocumentRevisions.UID")

COMP_CheckIfOnlyWorkingDocExists - This function will return the latest working revision of the document, if available. If no working revision is available, no output is returned.

func.Decode([COMP_GetLatestWorkingDocRevisionUID], {"", [COMP_GetLatestCurrentDocRevisionUID]}, [COMP_GetLatestWorkingDocRevisionUID])

COMP_GetLatestDocRevisionUID - The actual mapping must be performed on this computed column as the other columns are needed for computation purposes only. This computed column checks to see if there is a current document, and then it will check to see if a working document also exists. If no working document exists, it will return the current document as the latest revision.

func.Decode([COMP_GetLatestCurrentDocRevisionUID], {"", [COMP_CheckIfOnlyWorkingDocExists]}, [COMP_CheckIfOnlyWorkingDocExists])