PM_DataSourceQueryFieldName

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_DataSourceQueryFieldName

Applications and the framework send the Const.PM_DataSourceQueryFieldName message to a data source to retrieve the window handle or bind variable of a data item.

Parameters

Name Description
nReturnType = wParam Specified whether to return the window handle, or the bind variable name for the data item. Specify Vis.DT_Handle to retrieve the window handle, or 0 to retrieve the bind variable.
sColumnName = SalString.FromHandle(nlParam) The sql column name of the data item to return

Returns

When nReturnType = Vis.DT_Handle, the return value is the data item window handle, converted to number.

When nReturnType = 0, the return value is the handle to a string containing the data item bind variable name.

Comments

Typically, applications will not need to use the Const.PM_DataSourceQueryFieldName message. It can however be necessary to override this message when using window variables instead of hidden data items to store e.g. parent keys.

Example

This example uses the Const.PM_DataSourceQueryFieldName message to bind t parent key 'company_id' to a user global variable instead of a data item.

Original SAL code:

On PM_DataSourceQueryFieldName
   If ( SalNumberToHString( lParam ) = 'COMPANY_ID' )
       And ( wParam != DT_Handle )
       Call UserGlobalValueGet( 'COMPANY_ID', i_sCompanyId )
       Return SalHStringToNumber( SalNumberToStrX( SalWindowHandleToNumber( i_hWndFrame ),0)
           || '.' || QualifiedItemNameGet( i_hWndFrame ) || '.sCompanyId')
   Else
       Return SalSendClassMessage( PM_DataSourceQueryFieldName, wParam, lParam )
New C# code:
private void dlgMoveProducts_MessageActions(ref SalMessage message)
{
    #region Actions
    switch (message.Code)
    {
        case Const.PM_DataSourceQueryFieldName:
            this.dlgMoveProducts_OnPM_DataSourceQueryFieldName(ref message);
            break;
    }
    #endregion
}

private void dlgMoveProducts_OnPM_DataSourceQueryFieldName(ref SalMessage message)
{
    #region Actions
    message.Handled = true;
    if ((Sal.NumberToHString(message.LParam) == "COMPANY_ID") &&
        ((SalNumber)message.WParam != Vis.DT_Handle))
    {
        message.Return = ((SalString)"i_hWndFrame.dlgMoveProducts.sCompanyId").ToHandle();
    }
    else    
    {
        message.Return = Sal.SendClassMessage(Const.PM_DataSourceQueryFieldName, 
                                              message.WParam, message.LParam);
    }

    #endregion
}
#endregion