PM_DataItemValidate

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

Const.PM_DataItemValidate

The Const.PM_DataItemValidate message is sent to a data item when it needs to be validated.

Parameters

Name Description
wParam Unused
lParam Unused

Returns

Application should return Sys.VALIDATE_Ok if processing this message and validation was successfully performed. If the validation fails (e.g. the value is not valid), Sys.VALIDATE_Cancel should be returned.

Comments

The framework is capable of performing many types of validation automatically. Applications need only catch the Const.PM_DataItemValidate to perform additional validation. The framework will perform the following validations automatically:

Note: Validation method specified in Foundation1 properties is called after the Const.PM_DataItemValidate message is sent, and then only if Const.PM_DataItemValidate returns Sys.VALIDATE_Ok.

Example

This example catches the Const.PM_DataItemValidate message to check a customers credit before allowing that customer to place an order.

Sal code:

On PM_DataItemValidate
   If DbPLSQLBlock( c_hSql, '&AO.Demo_Customer_API.Check_Credit(
          :i_hWndFrame.frmDemoOrderOnTab.dfsCompanyId,
          :i_hWndFrame.frmDemoOrderOnTab.dfsCustomerId )' )
       Return VALIDATE_Ok
   Else
       Return VALIDATE_Cancel

C# version:

private void dfsBranchId_MessageActions(ref SalMessage message)
{
    switch (message.Code)
    {
        case Ifs.Fnd.ApplicationForms.Const.PM_DataItemValidate:
            dfsBranchId_OnPM_DataItemValidate(ref message);
            break;
        
        default:
            break;
    }
}

private void dfsBranchId_OnPM_DataItemValidate(ref SalMessage message)
{
     message.Handled = true;
 
     if (DbPLSQLBlock(cSessionManager.c_hSql,
                      @":i_hWndFrame.frmInventoryDetails.dfsCountryId :=
                          &AO.Trn_Branch_API.Get_Country_Id(
                              :i_hWndFrame.frmInventoryDetails.dfsCompanyId IN,
                              :i_hWndFrame.frmInventoryDetails.dfsBranchId IN)"))
    {
        message.Return = Sys.VALIDATE_Ok;
    }
    else
    {
        message.Return = Sys.VALIDATE_Cancel;
    }

}