cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering Dropdown Lists Based on Other Input

Alexander_Steen
Confirmed Champ
Confirmed Champ

Hello all,

I'm posting this in the API section, but I'm really looking for any available solution. I go through API certification training next week so, if the answer is to wait until after that, it isn't ideal, but at least I'll know.

We have a Unity Form we use to input invoices and code them for accounting. The accounting section has four different dropdown lists. If I just put the valid values for each drop down in their applicable dataset, we run the risk of having users put in invalid combinations. There is no single key that dictates what the other fields will be, either. I could validate the combination after everything is input, but I was hoping for something a little more proactive.

Working with Unity Scripts, I was hoping there might be a way to filter the drop down lists based on the input of each previous field. So, once field one was populated, fields 2, 3, and 4 would only include options that were valid with field one. Then when 2 was populated, 3 and 4 would only include options that were valid with both 1 and 2. Is there a way to either create the dropdown lists on the fly in a script or filter what is displayed without changing the autofill keyword set or data set that feeds each drop down? Can I do this before next week? Please let me know if you have any ideas. Thanks in advance.

2 ACCEPTED ANSWERS

Stefan_Sulea
Star Contributor
Star Contributor

Hi Alexander,

You can try the following:

-use keywords for your Unity Form field source (not XML), for those four fields

-use an Unity Script as the source of  External Data Set on the four keywords

-filter the data set for the keywords based on the value of the other keywords already entered. Refer to the "Working with External Keyword Data Sets" chapter on sdk.onbase.com. 

"The args parameter of the IExternalKeywordDataSetScript interface provides access to all information related to an associated Keyword Data Set.

  • args.KeywordType – The Keyword Type calling the function.

  • args.Results – Results object to pass back to the calling client.

  • args.SearchParameters.FilterText – Text that has been typed in by a user. Use to constrain results."

  • args.SearchParameters.RelatedKeywordRecords - this gives access to other keywords entered

View answer in original post

Alexander_Steen
Confirmed Champ
Confirmed Champ

Stefan,

That is exactly what I was looking for. Thank you!

I did have an additional question, though. When using args.SearchParameters.RelatedKeywordRecords.Find, it asks for a Keyword as the parameter. How do I get the value for that Keyword so that I can filter? I want to use the values the user selected on the form, but I'm not sure how to get them.

View answer in original post

5 REPLIES 5

Stefan_Sulea
Star Contributor
Star Contributor

Hi Alexander,

You can try the following:

-use keywords for your Unity Form field source (not XML), for those four fields

-use an Unity Script as the source of  External Data Set on the four keywords

-filter the data set for the keywords based on the value of the other keywords already entered. Refer to the "Working with External Keyword Data Sets" chapter on sdk.onbase.com. 

"The args parameter of the IExternalKeywordDataSetScript interface provides access to all information related to an associated Keyword Data Set.

  • args.KeywordType – The Keyword Type calling the function.

  • args.Results – Results object to pass back to the calling client.

  • args.SearchParameters.FilterText – Text that has been typed in by a user. Use to constrain results."

  • args.SearchParameters.RelatedKeywordRecords - this gives access to other keywords entered

Alexander_Steen
Confirmed Champ
Confirmed Champ

Stefan,

That is exactly what I was looking for. Thank you!

I did have an additional question, though. When using args.SearchParameters.RelatedKeywordRecords.Find, it asks for a Keyword as the parameter. How do I get the value for that Keyword so that I can filter? I want to use the values the user selected on the form, but I'm not sure how to get them.

If I read your question correctly, you should use the 3rd overload for the "Find" method (KeywordType is the parameter). 

Step 1: You want to pass a KeywordType, which will return the first keyword record from the document that contains the KeywordType.

Step2: Second, you want to "Find" the keyword within the keyword record you received from Step 1, the keyword object returned will have the value you want to use in your search.

Good luck!

 

Shane, that makes sense, thank you! 

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.