Forums / SmartComponent Library - Developer Forum / BusinessEntityAdatper - question

BusinessEntityAdatper - question

4 posts, 0 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    343 posts
    Registered:
    29 Jun 2018
    23 Nov 2020
    Link to this post
    I have a SmartWindowForm that contains a BusinessEntityAdapter and a SmartDatasetChildAdapter as well as other UI controls.

    All is good.

    Now, I want to open a dialog and display a subset of the records from the SmartDatasetChildAdapter. in an updateable browser.

    What is the best way to do this? I tried dropping a SmartDatasetChildAdapter on the form and then using the SET implementation below to set the child adapter's LinkDataSource and other properties. 

    DEFINE PUBLIC PROPERTY PurchaseOrderAdapter AS Osprey.CustomClasses.SmartComponents.OspreyBusinessEntityAdapter NO-UNDO
     GET.
     SET(INPUT arg AS Osprey.CustomClasses.SmartComponents.OspreyBusinessEntityAdapter):
      
      IF VALID-OBJECT (arg) THEN
      ASSIGN
       THIS-OBJECT:PurchaseOrderAdapter    = arg
       THIS-OBJECT:PoLineAdapter:LinkDataSource  = arg
       THIS-OBJECT:PoLineAdapter:EntityTable    = "ePoLine".
       THIS-OBJECT:PoLineAdapter:ForeignFields   = "OrderNum,OrderNum,SeqNum,SeqNum".
       THIS-OBJECT:PoLineAdapter:LinkFilterSource   = ?.
       THIS-OBJECT:PoLineAdapter:LinkGroupCreateSource = ?.
       // THIS-OBJECT:PoLineAdapter:LinkNavigationSource = THIS-OBJECT:PurchaseOrderToolbar.
       // THIS-OBJECT:PoLineAdapter:BeforeCreateRecord:Subscribe(THIS-OBJECT:PoLineAdapter_BeforeCreateRecord).
       .     
     END SET.

    I am getting the error Invalid value "" for EntityTable when I try an open the form.

    PrepareBindingQuery Consultingwerk.SmartComponents.Support.SmartBusinessEntityQuerySupport at line 541  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Support\SmartBusinessEntityQuerySupport.r)
    PrepareDataBinding Consultingwerk.SmartComponents.Implementation.SmartDatasetChildAdapter at line 1144  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartDatasetChildAdapter.r)
    RetrieveData Consultingwerk.SmartComponents.Implementation.SmartDatasetChildAdapter at line 1337  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartDatasetChildAdapter.r)
    ParentPositionChanged Consultingwerk.SmartComponents.Base.SmartDatasetAdapter at line 2946  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Base\SmartDatasetAdapter.r)
    ParentPositionChangedBase Consultingwerk.SmartComponents.Base.SmartDataAdapter at line 2187  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Base\SmartDataAdapter.r)
    SetSmartDataSource Consultingwerk.SmartComponents.Base.SmartDataAdapter at line 2657  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Base\SmartDataAdapter.r)
    SetSmartDataSource Consultingwerk.SmartComponents.Implementation.SmartDatasetChildAdapter at line 1598  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartDatasetChildAdapter.r)
    propSet_SmartDataSource Consultingwerk.SmartComponents.Base.SmartDataAdapter at line 2589  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Base\SmartDataAdapter.r)
    propSet_LinkDataSource Consultingwerk.SmartComponents.Base.SmartDataAdapter at line 840  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Base\SmartDataAdapter.r)
    propSet_PurchaseOrderAdapter Osprey.Host.PurchaseOrder.PurchaseOrderReceiveForm at line 45  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderReceiveForm.r)
    ShowForm Osprey.Host.PurchaseOrder.PurchaseOrderReceive at line 157  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderReceive.r)
    ReceivePo Osprey.Host.PurchaseOrder.PurchaseOrderReceive at line 108  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderReceive.r)
    Receive Osprey.Host.PurchaseOrder.PurchaseOrderMaintForm at line 2907  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderMaintForm.r)
    AnalyzeToolClick Osprey.Host.PurchaseOrder.PurchaseOrderMaintForm at line 264  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderMaintForm.r)
    PurchaseOrderToolbar_ToolClick Osprey.Host.PurchaseOrder.PurchaseOrderMaintForm at line 2843  (C:\ProgressWrk\OspreyVer117102\OspreyHostBackOffice\Osprey\Host\PurchaseOrder\PurchaseOrderMaintForm.r)
    OnToolClick Consultingwerk.SmartComponents.Implementation.SmartToolbarController at line 2015  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartToolbarController.r)
    OnToolClick Osprey.CustomClasses.SmartComponents.OspreyToolbarController at line 541  (C:\ProgressWrk\OspreyVer117102\OspreyFramework\Osprey\CustomClasses\SmartComponents\OspreyToolbarController.r)
    SetupApp.p at line 207  (C:\ProgressWrk\OspreyVer117102\OspreyHost\client\host\SetupApp.r)
    C:\ProgressWrk\OspreyVer117102\OspreyHost\client\host\OspreyHost.p at line 531  (C:\ProgressWrk\OspreyVer117102\OspreyHost\client\host\OspreyHost.r)
    adecomm/_runcode.p at line 678  (adecomm/_runcode.r)
    C:\Progress\OpenEdge\oeide\eclipse\plugins\com.openedge.pdt.debug.core_11.7.8.00\abl\_debuglauncher.p at line 100  (C:\Progress\OpenEdge\oeide\eclipse\plugins\com.openedge.pdt.debug.core_11.7.8.00\abl\_debuglauncher.p)






  2. Roger Blanchard
    Roger Blanchard avatar
    343 posts
    Registered:
    29 Jun 2018
    24 Nov 2020
    Link to this post
    I ended up passing the ChildAdapter and that seems to work.
  3. Roger Blanchard
    Roger Blanchard avatar
    343 posts
    Registered:
    29 Jun 2018
    27 Nov 2020 in reply to Roger Blanchard
    Link to this post
    As I noted above I used a property in the form to assign the childadapter properties. This works great but can I filter the records? I tried use QueryString but that does not work as this must be set in the SmartDatasetAdapter based on foreign fields.

    Basically, I want to display a subset of the records from the ChildAdapter on the main form. Is this possible?

    DEFINE PUBLIC PROPERTY DataSourceFromMaintFormAS OspreyChildAdapter NO-UNDO 
    GET.
    SET(INPUT arg AS OspreyChildAdapter):

    IF NOT VALID-OBJECT (arg) THEN 
    RETURN.

    THIS-OBJECT:PoLineAdapter:LinkDataSource= arg:LinkDataSource.
    THIS-OBJECT:PoLineAdapter:ForeignFields= arg:ForeignFields. 
    THIS-OBJECT:PoLineAdapter:EntityTable= arg:EntityTable.
    /* Roger Blanchard / Osprey Retail Systems Nov 24, 2020
    What is below will not work as it kils the QueryString since the QueryString
    is created from the ForeignFields 
    */
    // THIS-OBJECT:PoLineAdapter:QueryString= "WHERE ePoLine.Stat < 3". // we only want PoLines that have not been received fully  

    END SET.
  4. Roger Blanchard
    Roger Blanchard avatar
    343 posts
    Registered:
    29 Jun 2018
    27 Nov 2020 in reply to Roger Blanchard
    Link to this post
    I am not sure this is the best way but I add a ColumnFilter to the UltraGrid and that seems to do what we need.

    We do have to enable "SmartFilterActive" on the grid.

    METHOD PRIVATE VOID PoLineBrowser_InitializeLayout( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs ):

    DO ON ERROR UNDO, THROW: 

    e:Layout:Bands[0]:ColumnFilters["Stat"]:FilterConditions:Add(FilterComparisionOperator:LessThan, 3).

    CATCH eError AS Progress.Lang.Error :
    LogManagerWrapper:WriteError(eError). 
    END CATCH.

    END.  

    RETURN.


    END METHOD.
4 posts, 0 answered