Service Manager / Service Center Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple condition in a query to filter data from a global list

SOLVED
Go to solution
SanjeevDas
Frequent Visitor

Multiple condition in a query to filter data from a global list

Hi Experts,

 

I have 5 fields in a custom form, those are division, category, subcategory,type and subtype.

 

Division is a drop down menu and has value hardcoded in the form designer.

 

Category is a comfill mapped with the category attribute in cm3rcat table and the data is filtered related to the division selected. For the additional query is defined in link.

 

Subcategory is also a comfill mapped with the subcategory attribute cm3rsubcat table and the data is filtered realted to the category selected.

 

Type is a dropdown menu mapped with the type attribute of another table(called as changeModel).

To get the data in type field I  have created a global list mapping the field:type and file:changeModel

 

In 'fd' for my custom form, for the field "type" I have filtered the data related to only subcategory by defining the Value list Condition >select("type","changeModel","subcategory",[custom_form_subcat]), where custom_form_subcat is the attribute for subcategory field in my form.  I want to filter the data in type field, related to category and subcategory both.

 

For e.g.

Lets say, Category:Application Services and Subcategory:Application has type:Test1

Again say, Category:Software and Subcategory:Application also has type:Test2

 

So whenever, I choose category as Software and subcategory as Application in my custom form, the type shows two data Test1 and Test2

The same thing happens when I choose category as Application Services and subcategory as Application.

 

If only I could defined a condition where I can filter the "type" data by quering both "category and subcategory"

 

please help.

 

Thanks,

Sanjeev

 

 

 

 

5 REPLIES
Vadim Gorda
Honored Contributor
Solution

Re: Multiple condition in a query to filter data from a global list

Hello,

If i got you right  you need to write a select with 2 conditions .

It can be done if your select must work with one table like:

 

select("value_to_return","table_to_select_from","field_in_table_to_select_from_to_compare",[field_in_current_table_to_compare], "another_field_in_table_to_select_from_to_compare",[another_field_in_current_table_to_compare])

SanjeevDas
Frequent Visitor

Re: Multiple condition in a query to filter data from a global list

Hi Vadim,

 

The solution worked. However, the field contains several duplicate values. How do I block the duplicate values from the drop down menu?

 

Thanks,

Sanjeev

Vadim Gorda
Honored Contributor

Re: Multiple condition in a query to filter data from a global list

Hello,

I am not sure why do you have multiple meaning  there. In the target table there are only one unique value per set os the select fields?  Maybe there are  extra not needed values there?

SanjeevDas
Frequent Visitor

Re: Multiple condition in a query to filter data from a global list

Hi Vadim,

 

The field "type"  i am referring to is not unique.

 

field "subtype" is unique.

 

So for e.g:

category: Services, subcategory: server, Type:Intel have subtype: patches

category: Services, subcategory: server, Type:Intel have subtype:Installtion

category: Services, subcategory: server, Type:Intel have subtype: Re-installation

and so on.

 

So the "type" field in the form checks the combination (category and subcategory) and populates the data > Intel,Intel,Intel in the drop down box.

I want the repetative data to be omited so that "Intel"  appear once after checking the category and subcategory combination.

 

Hope I was able to convey this properly.

 

Thanks,

Sanjeev

 

 

Highlighted
Vadim Gorda
Honored Contributor

Re: Multiple condition in a query to filter data from a global list

Maybe we dont understand each other , but what do i mean , if you have a unique set of the selectable parameters  then you should not have duplicates, if they are not unique , then it is normal to have some duplicates as in fact they are result of the select

//Add this to "OnDomLoad" event