Solved

Trying to filter a list lookup based on two drop down selections

  • 26 January 2016
  • 6 replies
  • 343 views

Badge +4

I'm working on an activity tracker, users will select the Team (choice of three; AA, BB, CC) and the Type (choice of two; AdHoc or Regular) and i need to use those two values to filter a lookup list of tasks.

 

For example, this is the list i am trying to get data from, based on team and type fields the user selects i would like to return the third column.

 

   

Team Type Task
AA Regular TPI Report
AA Regular BU Request
AA Regular Other
BB Regular Trade Log
BB Regular Applicability of New Rules
BB Regular Other
BB Regular Intranet Upload
CC Regular Scope of Permission
CC Regular Report submissions
CC Regular Register Metrics Report
CC Regular Other
AA AdHoc Research
AA AdHoc Other Reports
AA AdHoc Query resolving
AA AdHoc Other
BB AdHoc Meeting set up
BB AdHoc Formatting (In word or PPT)
BB AdHoc Providing access
BB AdHoc Other
CC AdHoc Consultation
CC AdHoc Other

 

  • The Lookup control doesn't give an option to use multiple criteria to filter.
  • I tried creating a helper column concatenating the two fields in the list and a calculated value in the form doing the same - the Lookup control filter doesn't work with the calculated value
  • Cascading lookups as described here won't work because any of the Teams can have either of the Types and as far as i can see that solution reqiures the second field to be exclusive to the first field.
  • List Lookup filter doesn't give the option of filtering by a variable

 

I've hit a total block and all i can find is are other people asking similar questions (1, 2) without answers.

 

Any help or advice would be highly appreciated.

icon

Best answer by pfudala 26 January 2016, 19:01

View original

6 replies

Badge +7

Hi Mishaal,

There's a way to do this using some tips and JavaScript.

I assume your helper column in the list is called HelperColumn.

Set your 2 lookup fields "Team" and "Type" in the form.

Add an hidden field called "HiddenField". (Add on rule to hide it anytime).

These 3 controls are set to store Client ID in JavaScript variable with their respective name, as below :

Add a lookup control to your "tasks" list and set the "Filtering" section as below :

Finally add (and adapt) this script to the "Custom Javascript" section of the form settings :

NWF.FormFiller.Events.RegisterAfterReady(function()

{

    NWF$("#"+TeamControl).change(ProcessConcatenation);

    NWF$("#"+TypeControl).change(ProcessConcatenation);

    function ProcessConcatenation()

    {

        var teamValue = NWF$("#"+TeamControl).find("option:selected").text();

        var typeValue = NWF$("#"+TypeControl).find("option:selected").text();

        NWF$("#"+HiddenField).val(teamValue+typeValue);       

        NWF$("#"+HiddenField).trigger("change");

    }

});

If it worked as expected, you should have this :

Badge +4

Thanks Pierre,

I got it working using your solution but i had really been hoping to avoid using javascript. It makes the documentation and maintenance that much harder. It's a bit ridiculous to me that you can't perform a lookup filter by multiple criteria or from a calculated value.

Userlevel 3
Badge +8

Hi,

Does this still work ? I can't get this to work at all at the moment.

Badge +4

HI Andrew,

This probably won't work now that the Javascript handling of nintex got all messed up by version 2.10.0, but now it does let you filter a lookup by a calculated value. So that's one thing.

Badge +3

Hi


 


Can this be done without the hidden field.  As l would have to create the column "Hidden" also what is the control for the column "Hidden" in the form is it a "choice"

I had use the same logic but its not setting the values in the list lookup even after triggering the change on textbox control i.e. hidden textbox in form can you please guide


 













































NWF.FormFiller.Events.RegisterAfterReady(function ()
{
NWF$("#"+ddlPrintedMaterial).change(ProcessConcatenation); 
 function ProcessConcatenation()   
 {
 debugger;      
   var teamValue = NWF.RuntimeFunctions.parseLookup(NWF$('#'+ddlPrintedMaterial).val(),true);   
          NWF$("#"+varTextboxCurrentCode).val(teamValue);
        NWF$("#"+varTextboxCurrentCode).trigger("change");  
   }
})













Reply