Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

Posted on by 529

Hello,

The Main of what I need is filter the all the Route Job operations by Product number in the JobRegistration. That is to make the clock in faster since every woker nows their Production Number and ther is only few operation (7 total) to which they can stample in.

so the idea is attach one lookup field for ProdId and the filter the Grid JmgTobTable  for the available jobs in that selected ProdId

Here I have and example of a new Form i am working on. I already have the  prodId lookup Field but first. I would like to filter the jobTableGrid for only jobs in productions (as you can see is displaying all; including the system).

1. filter the Grid by Reference Id

2. filter Grid by the Selected ProdId

pastedimage1585040509294v1.png

I am not expert. since i am starting with this X++ coding , So I would appreciated that you could be as specific (for begginer) as possible so I can get this to work

thanks a lot for your kindly help

Have a great  day!

  • Suggested answer
    CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    That was a good one Sergei, i woulnt have guessed.

    I added my two testing Fields in the If validation. Now I understand that it was calling the Login() method everytime I was pressing 'enter' so the form was changing back and forth.

    else if (_taskId == #ENTER)

       {

           if(element.selectedControl())

           {

               selectedControlName = element.selectedControl().name();

           }

           if ((!reqPassword && selectedControlName != ScannerInput.name()

                 /*->NestorC 30-03-2020*/  

                 && selectedControlName != NC_ScannerDataMethod.name()

                    && selectedControlName != NC_ScannerProdInput.name() /*<-NestorC 30-03-2020*/)

                    || selectedControlName == passTextField.name() )

           {

               element.login();

               feedbackNum = '';

           }

       }

    Even though the excecuteQuery() takes little bit of time, the form is not refreshing like before. I will end this thread as finished .

    Thanks big time for your help!

    спаси́бо

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Hi CBNestor,

    There is "Enter" if statement in "task" method on the form. Try to debug it, maybe there is some additional logic is added.

  • CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Hi Sergei,

    I have deleted all my customizations and methods from this form.

    I just add a String edit field just above the orginal ScannerInput. If I press Enter in that new field the whole screen refreshes  with some annoying delay. That does not happens with the original ScannerInput.

    I do not have any clue where to look. Is not the query, is not my code, I do not know what is triggering that

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Hi CBNestor,

    Super on modifiedField method shouldn't take to much time to execute. In ExecuteQuery method super is needed, because it actually refreshes data from the database.

    I would check in your case queries generated by this form in SQL side (maybe you can improve performance by indexing) when you perform filtering and also there is NC_View_Jmg....:Find method which probably also consumes some time, check query plan for this query as well.

  • CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    If I start to compile I can notice that calling the super() from the modified() and excecuteQuery() takes like quarter seconds each to go through all the differents methods above and return again with the response.

    Maybe is there I better way to code it?. 

    If I take the example of the original ScannerInput control it has jobId() as the DataMethod and this is not calling any Super() method. it is just doing the this.setFocusDelayed(ScannerInput) which for me if just saving the time to reading all the differents methods over and over again.

     

    pastedimage1585396453198v4.png

    pastedimage1585395986207v1.pngpastedimage1585396102648v3.png

  • Suggested answer
    CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    I managed to set the focus to my Control,

    inside the JmgRegistration Form there is a Method Called scrSwitch; which is in charge of changing screen from login to the grid and viceversa

    else if (useScanner)

       {

           element.setFocusDelayed(NC_ScannerProdInput); //NestorC 28-03-2020 My Control

           /*->NestorC 28/03/2020

           element.setFocusDelayed(scannerInput);

           <-NestorC 28/03/2020*/

       }

    I would like to know from The Control Method like a stringedit how can I call the main Form's methods? Example:

    pubilc boolean modified(){

         JmgRegistration.setFocusDelayed(this);

    }

    still cannot find how to avoid this delay or form refresh everytime the control is getting Modified(), looks like the from is calling all the methods inside of him on every single change.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Hi CBNestor,

    I haven't worked too much with this form, but I see there is a method setFocusDelayed. I think if you try to debug it I will give you some answers about delays (as there is a timeout method is used) and how to change focus when you scan barcode to your control.

  • Suggested answer
    CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    hi Sergei,

    probably we are a little bit on different page. maybe is that. But I manage too make it in a different way. I override the Lookup() method directly to the StringEdit field. The problem was that the lookup method was overrided from the Field inside the DataSource and later on linked in the DataSource/DataField property of the StringEdit.

    So I created a View to filter only the active/markable productions. added it into JmgRegistration Form. and the lookup attached to the stringedit calling the View inside the code X++. So is working and Filtering the jobs Grid with the Selected Production.

    The only two things missing is changing  the SetFocus() from the original ScannerField to the customized StringEdit. and when I scan the code using the Barcode I see a half second delay for the stringedit to change and the grid to refresh. Does not feel proffesional if you ask me

    pastedimage1585230204541v1.png pastedimage1585230262897v2.png pastedimage1585230349124v3.png

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Hi CBNestor,

    It's disabled because of AllowEdit property on ProdTable.ProdId field. You are allowed to change the value only for new records.

    Did I miss something or you wanted to create filter control? For filter controls, you don't need to fill data source property for the filter control, but you can still use the same EDT as used on the field to inherit labels and other properties and lookup can be overridden on control level as well.

  • CBNestor Profile Picture
    CBNestor 529 on at
    RE: Filter JobRegistration Grid with ProdNumber Lookup Field AX 2012 R3

    Excellent Sergei that worked for my lookup method for the JmgJobTable.ModuleRefId

    But when I apply the exact same logic for the ProductTable.ProdId the StringEdit shows disable. Cannot click and/or select anything is not displaying anything :( :(

    even I tried with Using a View (showing the active not reportedFinished productions) as a Datasource and tried with the Lookup method for the ProdId but again the same. Stringfield disabled ...

    there is some logic a cannot undestand yet

    thanks again for your kind help

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans