PdcApplication.ActiveObjectPickFilter: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == ActiveObjectResult as Boolean == Description == Returns the active object result == Notes == Especially useful when the checks or inputs done in the scrip..."
 
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Declaration ==
== Declaration ==
ActiveObjectResult as Boolean
ActiveObjectPickFilter as String


== Description ==
== Description ==
Returns the active object result
Sets an active object string


== Notes ==
== Notes ==
Especially useful when the checks or inputs done in the script may decide not to close the form in PdC.
Especially useful to set a filter expression in script. This expression is used in the picklist.
E.g. for mandatory data entry.


== Code example ==
== Code example ==
In userexit SCR_BEFORECALCCLOSE check for a not null field. In case userfield3 is empty, the form may not be closed.
In userexit SCR_BEFORECHOOSEDELIVERYLINE check for the external order number in the first line of an active delivery note.
After closing the message box the user is returned to the calculation form.
Give the external order number as result to the picklist.


<source lang="vb">
<source lang="vb">
dim objCalc
dim Activewindow
dim Activegrid
dim strFilter
dim strCalcNo
dim strOrderNo
 
  set ActiveWindow = pdc.Windows.ActiveWindow
  if ActiveWindow.WindowKey = "PB" then 'active delivery note
    set Activegrid = pdc.Windows.ActiveWindow.Datagrids.GetGridByName("PDCGrid1", "PR_POS")
    if IsValid(Activegrid) then
      if Activegrid.Recordcount > 0 then
        if strFilter = "" then
          strOrderNo = Activegrid.GetField("PR_EORDN")
          if strOrderNo<> "" then
            strFilter = "(UPPER(DO_EORDN)=UPPER('" & strOrderNo& "'))"
            PDC.ActiveObjectPickFilter = strFilter
          end if
        end if
      end if
    end if
    set Activegrid = nothing
  end if
  set ActiveWindow = nothing


  if objCalc.UserString(2) = "" then
    pdc.ActiveObjectResult = false
    msgbox "Please enter value for UserField3"
  else
    pdc.ActiveObjectResult = true
  end if
</source>
</source>


== Availability ==
== Availability ==
Available since June 2006 (From version 3.7).
Available since September 2014 (From version 5.0 upwards).

Latest revision as of 10:49, 2 October 2014

Declaration

ActiveObjectPickFilter as String

Description

Sets an active object string

Notes

Especially useful to set a filter expression in script. This expression is used in the picklist.

Code example

In userexit SCR_BEFORECHOOSEDELIVERYLINE check for the external order number in the first line of an active delivery note. Give the external order number as result to the picklist.

dim Activewindow
dim Activegrid
dim strFilter
dim strCalcNo
dim strOrderNo

  set ActiveWindow = pdc.Windows.ActiveWindow
  if ActiveWindow.WindowKey = "PB" then 'active delivery note
    set Activegrid = pdc.Windows.ActiveWindow.Datagrids.GetGridByName("PDCGrid1", "PR_POS")
    if IsValid(Activegrid) then
      if Activegrid.Recordcount > 0 then
        if strFilter = "" then
          strOrderNo = Activegrid.GetField("PR_EORDN")
          if strOrderNo<> "" then
            strFilter = "(UPPER(DO_EORDN)=UPPER('" & strOrderNo& "'))"
            PDC.ActiveObjectPickFilter = strFilter
          end if
        end if
      end if
    end if
    set Activegrid = nothing
  end if
  set ActiveWindow = nothing

Availability

Available since September 2014 (From version 5.0 upwards).