Re: Multiple condition in a query to filter data from a global list (188 Views)
Reply
Trusted Contributor
SanjeevDas
Posts: 384
Registered: ‎06-17-2013
Message 1 of 6 (213 Views)
Accepted Solution

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

[ Edited ]

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

 

 

 

 

Please use plain text.
Honored Contributor
Vadim Gorda
Posts: 5,685
Registered: ‎11-10-2008
Message 2 of 6 (188 Views)

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])

Please use plain text.
Trusted Contributor
SanjeevDas
Posts: 384
Registered: ‎06-17-2013
Message 3 of 6 (183 Views)

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

Please use plain text.
Honored Contributor
Vadim Gorda
Posts: 5,685
Registered: ‎11-10-2008
Message 4 of 6 (181 Views)

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?

Please use plain text.
Trusted Contributor
SanjeevDas
Posts: 384
Registered: ‎06-17-2013
Message 5 of 6 (176 Views)

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

[ Edited ]

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

 

 

Please use plain text.
Honored Contributor
Vadim Gorda
Posts: 5,685
Registered: ‎11-10-2008
Message 6 of 6 (170 Views)

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

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation