PdcApplication.ActiveObjectPickFilter: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:


== Notes ==
== Notes ==
Especially useful to set a filter expression in script  
Especially useful to set a filter expression in script. This expression is used in the picklist.
== Code example ==
== Code example ==
In userexit SCR_BEFORECHOOSEDELIVERYLINE check for the [project number in the first line of an active delivery note.
In userexit SCR_BEFORECHOOSEDELIVERYLINE check for the [project number in the first line of an active delivery note.
Give the projectnumber as result to the picklist.


<source lang="vb">
<source lang="vb">
dim objCalc
dim objCalc


   if objCalc.UserString(2) = "" then  
dim strPBnr
    pdc.ActiveObjectResult = false
dim activewindow
    msgbox "Please enter value for UserField3"
dim activegrid
  else
dim strFilter
     pdc.ActiveObjectResult = true
dim strCalcNo
   end if  
dim strProjectNo
dim tblCalc
 
  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
          strCalcNo = Activegrid.GetField("PR_CALCNR")
          if strCalcNo <> "" then
            strProjectNo = GetAnyField("DO_CALC", "DO_ORDNR", strCalcNo, "DO_OFFNR")
            strFilter = "(UPPER(DO_OFFNR)=UPPER('" & strProjectNo & "'))"
            PDC.ActiveObjectPickFilter = strFilter
          end if
        end if
      end if
    end if
     set activegrid = nothing
   end if
  set ActiveWindow = nothing
 
</source>
</source>


== Availability ==
== Availability ==
Available since June 2006 (From version 3.7).
Available since June 2006 (From version 3.7).

Revision as of 10:36, 2 October 2014

Declaration

ActiveObjectPickFilter as Boolean

Description

Sets an active object result

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 [project number in the first line of an active delivery note. Give the projectnumber as result to the picklist.

dim objCalc

dim strPBnr
dim activewindow
dim activegrid
dim strFilter
dim strCalcNo
dim strProjectNo
dim tblCalc

  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
          strCalcNo = Activegrid.GetField("PR_CALCNR")
          if strCalcNo <> "" then
            strProjectNo = GetAnyField("DO_CALC", "DO_ORDNR", strCalcNo, "DO_OFFNR")
            strFilter = "(UPPER(DO_OFFNR)=UPPER('" & strProjectNo & "'))"
            PDC.ActiveObjectPickFilter = strFilter
          end if
        end if
      end if
    end if
    set activegrid = nothing
  end if
  set ActiveWindow = nothing

Availability

Available since June 2006 (From version 3.7).