Re: Filter data in a dropdown field, related to the data from another field (153 Views)
Reply
Valued Contributor
SanjeevDas
Posts: 372
Registered: ‎06-17-2013
Message 1 of 8 (195 Views)
Accepted Solution

Filter data in a dropdown field, related to the data from another field

Hi Experts,

 

I have two fields "Division" and "Assignment Group" in a custom made form.

Division is a text field and Assignment group is a drop down menu with value list $G.assignment.groups

In assignment file the Assignment group(name) is related to the division.
For example lets say division 1 has group A, B, C

and division 2 has group D, E, F

and so on.

 

Now when i click on the Assignment group dropdown its showing all the groups irrespective of the division.

How do I add a filter so that the assignment dropdown menu show the groups only related to the division?

 

Any help will be appreciated.

 

Also please have a look on the link mentioned below

http://h30499.www3.hp.com/t5/HP-Service-Manager-Service/Fetch-data-from-other-fields-save-it-and-sho...

 

Thanks and Best Regards,

Sanjeev

Please use plain text.
Honored Contributor
Piku
Posts: 3,617
Registered: ‎06-17-2010
Message 2 of 8 (187 Views)

Re: Filter data in a dropdown field, related to the data from another field

Hi Sanjeev,

$G.assignment.groups contains all the assignment groups without any filter. This is a Global list and build on startup. So how you gets the full list.
Now you need list based on your division so you should use query in select condition of assignmnet.gotup filed like below,
select("name","assignment","division", [divisononform])

here assuming you have mentioned division name in each assignment group, so above will select groupname from assignment table where division value in file equals to division value mentioned on form (in field division form on your customized form)

hth,
Please use plain text.
Valued Contributor
SanjeevDas
Posts: 372
Registered: ‎06-17-2013
Message 3 of 8 (177 Views)

Re: Filter data in a dropdown field, related to the data from another field

Hi Piku,

 

Thanks for your feedback.

Tried runing the query but didn't help me.

Went to assignment.groups and under the Limiting SQL field wrote select("name","assignment","as.division","cust.division")

 

where name and as.division are the attributes for group name and division field in assignment file.

cust.division is the attribute for the division field in my custom table(associated to my custom form I mentioned earlier).

Why is the "assignment" mentioned in the query? Is it pointing to the assignment table?

 

Thanks,

Sanjeev

Please use plain text.
Honored Contributor
Abhijit K
Posts: 888
Registered: ‎10-14-2010
Message 4 of 8 (173 Views)

Re: Filter data in a dropdown field, related to the data from another field

as mentioned by piku in previously, use this query on form with combo field and also use proper syntax 

 

select("name","assignment","as.division",[cust.division])

 

 

Re,

Abhijit K

 

Please use plain text.
Honored Contributor
Piku
Posts: 3,617
Registered: ‎06-17-2010
Message 5 of 8 (171 Views)

Re: Filter data in a dropdown field, related to the data from another field

use ,
select("name","assignment","as.division",[cust.division])

assignment is table name where assignment group stores.
Please use plain text.
Valued Contributor
SanjeevDas
Posts: 372
Registered: ‎06-17-2013
Message 6 of 8 (161 Views)

Re: Filter data in a dropdown field, related to the data from another field

I am still not able to make it work.

 

Let me help you with what I have done.

 

Edited the Global list assignment.groups

 

List Name: assignment.groups

List Variable: $G.assignment.groups

Display Variable: $G.assignment.groups

List field: name

Display field: name

Filename: assignment

Limiting SQL: select("name","assignment","as.division",[cust.division])

 

My custom form chgautoassignment

fd: chgautoassignment

For the Combo Box Assignment

Input : cust.assignment

Value list: $G.assignment.groups

 

 

Having a hard luck with the filter here. Dont know where I am going wrong?

 

Thanks,

Sanjeev

 

Please use plain text.
Honored Contributor
Abhijit K
Posts: 888
Registered: ‎10-14-2010
Message 7 of 8 (157 Views)

Re: Filter data in a dropdown field, related to the data from another field

Hi,

This is wrong. Do not put select statement in Global list.

Follow below steps:

open form "chgautoassignment" in form designer.

In Design mode, select a combo box remove Value list as $G.assignment.groups from combo box field.

Go to Value list condition properties and put

select("name","assignment","as.division",[cust.division])

save twice and come out.

Access form and select cust.division field value in form. Then cust.assignment field value will populate based on cust.division.

Re,
Abhijit K
Please use plain text.
Valued Contributor
SanjeevDas
Posts: 372
Registered: ‎06-17-2013
Message 8 of 8 (153 Views)

Re: Filter data in a dropdown field, related to the data from another field

Thank you so much Avijit.

It worked. Thanks again for the much needed help.

 

Can you please have a look at another issue that i have posted in the forum

http://h30499.www3.hp.com/t5/HP-Service-Manager-Service/Fetch-data-from-other-fields-save-it-and-sho...

 

Any help will be appreciated.

 

Have a good day.

 

Best Regards,

Sanjeev

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