PM_DataItemLovUserWhere

Const.PM_DataItemLovUserWhere

The Const.PM_DataItemLovUserWhere message is sent to a data item when a LOV dialog is being created.

Applications should override this message to set the where statement for a LOV reference.

Parameters

Name Description
wParam Unused
bInvokedFromSearchDialog = lParam Flag indicates whether the LOV is invoked through the search dialog or not. TRUE if invoked from the search dialog or FALSE if not.

Returns

The return value is the where statement converted to number

Comments

The Const.PM_DataItemLovUserWhere message is useful when an application wants to use the same reference/view but with different where statements depending on the business logic for the actual form.

Be careful when using bind variables. Remember that the LOV dialog might be invoked from other places than the form (like search dialog), in which case variables like :i_hWndFrame will be out of context and must be resolved while constructing the statement.

Example

This example catches the Const.PM_DataItemLovUserWhere message to set a where statement that will be used in the LOV-dialog.

private void colsCategoryId_MessageActions(ref SalMessage message)
{
   switch (message.Code)
   {
      case Ifs.Fnd.ApplicationForms.Const.PM_DataItemLovUserWhere:
         colsCategoryId_OnPM_DataItemLovUserWhere(ref message);
         break;
  
      default:
         break;
   }
}

private void colsCategoryId_OnPM_DataItemLovUserWhere(ref SalMessage message)
{ 
    message.Handled = true;
    SalString sLovUserWhere = @"category_id IN (SELECT category_id 
                                       FROM &AO.Trn_Prod_Category_Brand
                                       WHERE brand_id = 'SOME_ID'";
    message.Return = sLovUserWhere.ToHandle();
} 

..................

private void colsCategoryId_OnPM_DataItemLovUserWhere(ref SalMessage message)
{
   SalString sLovUserWhere = "";
   message.Handled = true;
   
   // If not invoked from search dialog
   if (message.LParam == SalBoolean.False)
   {
      sLovUserWhere = @"category_id IN (SELECT category_id 
                                       FROM &AO.Trn_Prod_Category_Brand
                                       WHERE brand_id = :i_hWndFrame.tbwModelOverview.colsBrandId)";
   }

   message.Return = sLovUserWhere.ToHandle();     
}