Revision history:
Introduced in QPR 2012.2
Adds a new validation warning message to given element.
Synopsis:
PGModel.AddValidationWarning(Element, WarningMessage)
Parameters:
Element: Integer/String. Either an Element ID (integer) or Symbol of the Element (String). If this parameter is 0 or an empty string, the warning will be added to the element that is currently being validated.
WarningMessage: String. Validation warning message. Multiple warnings can be added to the same element.
The validation script can contain the following tags that will be replaced with the transaction specific values when the script is run:
•<#ElementId>: id of the element that is being validated
•<#ElementTypeId>: element type id of the element that is being validated
•<#TransactionId>: transaction id, unique inside the client session
•<#NewCount>: number of new elements in the transaction
•<#ModifiedCount>: number of modified elements in the transaction
•<#NewElement>: True if current element is a new element, False otherwise
•<#ModifiedElement>: True if current element is a modified element, False otherwise
•<#NewIndex>: if current element is a new element, index of the element in the transaction (-1 if current element is a modified element)
•<#ModifiedIndex>: if current element is a modified element, index of the element in the transaction (-1 if current element is a new element)
•<#TotalIndex>: total index of current element in the transaction
Required Rights:
None.
Return Values:
Below are listed the return values that this function can return:
RV_APPLICATION_QUIT_CALLED
RV_MODEL_NOT_OPEN
RV_ELEMENT_NOT_FOUND
Example Procedure:
Sub main()
Dim iElementId, iResult, sName, sFirstChar
iElementId = <#ElementId>
iResult = PGModel.GetProperty(iElementId, "Name", sName)
If iResult <> 0 Then
Exit Sub
End If
If sName = "" Then
iResult = PGModel.AddValidationWarning(0, "Element must have a name")
Exit Sub
End If
sFirstChar = Left(sName, 1)
If sFirstChar <> UCase(sFirstChar) Then
iResult = PGModel.AddValidationWarning(0, "Element's name must start with an upper-case letter")
Exit Sub
End If
End Sub