Business Entity Lookup Query String Manipulation
 
Forums / SmartComponent Library - Developer Forum / Business Entity Lookup Query String Manipulation

Business Entity Lookup Query String Manipulation

12 posts, 0 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    24 Jul 2020
    Link to this post
    I was reading the following but not sure that will work for me. What I want to do is manipulate the LookupDialogQueryString and LookupQueryString based on values in other controls in the viewer as well as a field from the viewers SmartDateSource:LinkDataSource

    https://consultingwerk.atlassian.net/wiki/spaces/SCL/pages/250282006/Release+Notes+2020-03-30#ReleaseNotes2020-03-30-SCL-2981SmartBusinessEntityLookupsupportforForeignFields

    Where is the best place do do this? I was trying in BeforePerformLookup as well as ShowLookupDialog.
  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    24 Jul 2020 in reply to Roger Blanchard
    Link to this post
    Hi Roger, 

    what do you believe will not work? 

    Cheers,

    Mike 
  3. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    24 Jul 2020 in reply to Mike Fechner
    Link to this post
    Maybe I just do not understand the syntax.

    I cant use the the ForeignFields of the lookup control as the values I want to use to manipulate the query are not defined as foreign fields in the viewers adapters.

    The SmartBusinessEntityLookup now provides support for Foreign Fields when performing the lookup on leave or after the timer interval and when opening the Lookup Dialog.

    >> This is exactly what I need but not based on ForeignFields. If ForeignFields are not specified then the logic does not appear to execute.

    Are you saying I can use this when they are not ForeignFields?


  4. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    24 Jul 2020 in reply to Roger Blanchard
    Link to this post
    The lookup or combo-boxes Foreign fields have nothing to do this the SmartBusinessEntityAdapter'sforeign fields.

    Similar concept - yes. But different use case here. 

    Rather than telling what you believe you can't do, can you please tell, what you want to do? 
  5. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    24 Jul 2020 in reply to Mike Fechner
    Link to this post
    I thought I did...

    I have disabled the lookup timer.

    I have defined in the lookup designed the following Lookup Query String as FOR EACH eItem WHERE eItem.ItemNum = "&1"

    This works....

    Now, I would like to include other values in that Lookup Query String. In one use case it would be from a value of a control in the viewer. In another use case it would be a value from the Viewer's adapters SmartDataSource:LinkDataSource

    I am asking what is the best way to do that?

    What I have tried is I defined the ProvideForeignFieldValue event for the lookup. This does not appear to get called unless I defined a value in the lookup ForeignFields property.

    If I add something to the ForeignFields property it will throw an error unless it is defined the same as the ForeignFields of the adapter or at least that is what it appears.



  6. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    24 Jul 2020 in reply to Roger Blanchard
    Link to this post
    The lookups and smartcombo's foreign fields method does not support to access field values from the viewers's smartdatasource's smartdatasource. If that's what you want to do.

    In that case, you need to subscribe to the ProvideForeignFieldValue event of the control and provide those values through your own code.

    "What I have tried is I defined the ProvideForeignFieldValue event for the lookup. This does not appear to get called unless I defined a value in the lookup ForeignFields property."

    That is expected.

    "If I add something to the ForeignFields property it will throw an error unless it is defined the same as the ForeignFields of the adapter or at least that is what it appears."

    Which error?

    That sounds like you are making a mistake somewhere and I'd like to see more details to help.
  7. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    24 Jul 2020 in reply to Mike Fechner
    Link to this post
    Okay,

    I have subscribed to the ProvideForeignFieldValue . 

    I have added @PackNum@ as a ForeignField and I get the following as soon as I open the form

    Unable to subscribe CurrentChanged event for Foreign Field @PackNum@ or eBatchItem_ItemNum. The Viewer's SmartDataSource is not valid.

    SubscribeEvents Consultingwerk.SmartComponents.Implementation.SmartDataFieldForeignFieldsHandler at line 659  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartDataFieldForeignFieldsHandler.r)
    InitializeForeignFields Consultingwerk.SmartComponents.Implementation.SmartDataFieldForeignFieldsHandler at line 589  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartDataFieldForeignFieldsHandler.r)
    EndInit Consultingwerk.SmartComponents.Implementation.SmartBusinessEntityLookup at line 333  (C:\ProgressWrk\OspreyVer117102\SmartComponentLibrary\Consultingwerk\SmartComponents\Implementation\SmartBusinessEntityLookup.r)
    InitializeComponent Osprey.Pos.BatchHdr.BatchItemViewer at line 2228  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Osprey\Pos\BatchHdr\BatchItemViewer.r)
    BatchItemViewer Osprey.Pos.BatchHdr.BatchItemViewer at line 121  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Osprey\Pos\BatchHdr\BatchItemViewer.r)
    InitializeComponent Osprey.Pos.BatchHdr.BatchHdrMaint at line 1050  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Osprey\Pos\BatchHdr\BatchHdrMaint.r)
    BatchHdrMaint Osprey.Pos.BatchHdr.BatchHdrMaint at line 75  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Osprey\Pos\BatchHdr\BatchHdrMaint.r)
    BatchHdrMaint Osprey.Pos.BatchHdr.BatchHdrMaint at line 233  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Osprey\Pos\BatchHdr\BatchHdrMaint.r)
    showMyMaintForm MainMenu at line 2139  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Client\Pos\MainMenu.r)
    ExplorerBar_ItemClick MainMenu at line 1296  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Client\Pos\MainMenu.r)
    SetupApp.p at line 212  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Client\Pos\SetupApp.r)
    C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Client\Pos\OspreyPOS.p at line 526  (C:\ProgressWrk\OspreyVer117102\OspreyPOS_BackOffice\Client\Pos\OspreyPOS.r)
    adecomm/_runcode.p at line 678  (adecomm/_runcode.r)
    C:\Progress\OpenEdge\oeide\eclipse\plugins\com.openedge.pdt.debug.core_11.7.6.00\abl\_debuglauncher.p at line 100  (C:\Progress\OpenEdge\oeide\eclipse\plugins\com.openedge.pdt.debug.core_11.7.6.00\abl\_debuglauncher.p)
  8. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    24 Jul 2020 in reply to Roger Blanchard
    Link to this post
    Where/how are you setting the viewer's SmartDataSource property? Or LinkDataSource property? 

    That does not seem to be see early enough. 
  9. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    24 Jul 2020 in reply to Mike Fechner
    Link to this post
    The LinkDataSource is set in the designer.

    This viewer is on page 2 of an ultratabcontrol.
  10. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    27 Jul 2020 in reply to Mike Fechner
    Link to this post
    Hey Mike,

    Any further thoughts on what I might be doing wrong?
  11. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    27 Jul 2020 in reply to Roger Blanchard
    Link to this post
    I'm afraid there's not a log you can do.

    What you should do is to create a support ticket and attach the Form's source code. There's not a lot we can do (and you can do) to influence the order in which EndInit is called on that viewer. Even though we have tested a bunch of possible layouts, something may be special in your form.

    So we might have to move the initialization of the events from the EndInit (where usually the links are set) to later in the OnLoad method. 

    But that will require a bit of testing again on our end.
  12. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    28 Jul 2020 in reply to Mike Fechner
    Link to this post
    Okay, I will do that. For now I wrote around it by not defining a LookupQueryString in the designed and assigning it in BeforePerfomLookup. That seems to do the trick for now.

    Thanks.
12 posts, 0 answered