How do you make dynamic dorpdowns from another form, where the dropdown values are uniquely listed?

Jonathan Knollmeyer May 25, 2018

I want to have multiple dropdowns on my form where the values from these dropdowns are coming from a second form.

As each field is selected, the next dropdown field should be filtered with the selected value.

I can get this to work, but all the dropdowns have repeated values. I want the dropdowns to contain a unique list of values, even if they belong to multiple rows on the source form.

If I change the field definition property: "Reference to field values" to false, I can get a unique list of values, but it breaks the filtering.

How can I accomplish this?

 

Here is my source code:

<ac:structured-macro ac:name="confiform">
<ac:parameter ac:name="formName">dd</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:name="confiform-entry-register">
<ac:parameter ac:name="formName">dd</ac:parameter>
<ac:parameter ac:name="embedded">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p> </p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:name="confiform-field-definition">
<ac:parameter ac:name="fieldName">mychoice1</ac:parameter>
<ac:parameter ac:name="fieldLabel">My choice 1</ac:parameter>
<ac:parameter ac:name="values">[277274429|esf|domain|true||domain.label]</ac:parameter>
<ac:parameter ac:name="type">smartselect2</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:name="confiform-field-definition">
<ac:parameter ac:name="fieldName">mychoice2</ac:parameter>
<ac:parameter ac:name="fieldLabel">My choice 2</ac:parameter>
<ac:parameter ac:name="values">[277274429|esf|program|true||program.label]</ac:parameter>
<ac:parameter ac:name="type">smartselect2</ac:parameter>
</ac:structured-macro>
</p>
<p> </p>
<p>
<ac:structured-macro ac:name="confiform-field-definition-rules">
<ac:parameter ac:name="fieldName">mychoice2</ac:parameter>
<ac:parameter ac:name="values">domain:[entry.mychoice1.domain]</ac:parameter>
<ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
<ac:parameter ac:name="actionFieldName">mychoice1</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>

 

2 answers

2 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2018

I believe that having a "Smart classifier" field in your "dd" form, pointed at "esf" form with fields "domain" and "program" will be a much better option

As the field type provides exactly what you are looking for, a way to have "dependent" dropdowns which are based on the data from single form

Jon K October 5, 2018

Thank you, this seems like it should work. I also found this page which demonstrates the behavior, but does not show the source:
https://wiki.vertuna.com/display/TEST/Using+smart+classifier+field+built+from+a+from+with+3+columns+-+3+levels+deep+classifier

 

However, I am encountering a bug when trying to use the Smart Classifier field.

Inside the "Edit ‘ConfiForms Form Field (Definition)’ Macro", I can not get the part for "Page where the ConfiForms Form is defined" to recognize any of my pages with forms.

I try to edit the source and the field does not show up at all after saving:

<ac:structured-macro ac:macro-id="377863af-ac97-4ca0-bb9d-4dbcb5eaf670" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">sm</ac:parameter>
<ac:parameter ac:name="fieldLabel">Smart Classifier</ac:parameter>
<ac:parameter ac:name="values">[322992200:esfform:product]</ac:parameter>
<ac:parameter ac:name="type">smartclass</ac:parameter>
</ac:structured-macro>

 

Any advice on why the Smart Classifier option will not recognize my pages where I have forms defined? It does find some pages where I do not have any forms.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2018

Most probably you need to rebuilt the search index, as these page lookups use the search index, and if you cannot see the page in the lookup results then it is, most obviously, means your index is obsolete

https://confluence.atlassian.com/doc/content-index-administration-148844.html

Jon K October 5, 2018

I was able to update the source like this and get it to work; but the "Page where the ConfiForms Form is defined" dropdown still does not recognize my page when trying to use the macro form.

Using this format in the source worked:
<ac:structured-macro ac:macro-id="53d87136-10de-401f-a784-c151d0f70a97" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">product</ac:parameter>
<ac:parameter ac:name="fieldLabel">Application</ac:parameter>
<ac:parameter ac:name="values">[322992200:esfform]product,service,channel,function,maxpriority,externalname,mim,</ac:parameter>
<ac:parameter ac:name="type">smartclass</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>

0 votes
Jon K October 7, 2018

Is there anyway to have one of the dependent fields as a multiselect by using Smart Classifier?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2018

Field of "Smart Classifier" type is designed to allow users to pick just one option from the dynamically filtered set of options

 

You can setup a smart multi-select field and have a field definition rule with action to "apply filter" configured to filter out the selections in this multi-select field based on the selections made in some other field

Jon K October 8, 2018

Thank you I was able to get this to work, but my filtered results shows duplicate values.

Is there anyway to only get unique values returned back to the Smart Mulitselect?

And would it be possible to have another multiselect that depends on the values of my previously filtered Smart Multiselect?

Basically, there are many dependent dropdowns which would all be multiselect fields; depending on the values in previous multiselect.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2018

What are duplicates and what are unique values in the multi-select when we talk about records filtered by the rule - I need to see an example of what you have, as most probably these are ALREADY unique records... but representing the same values

There are no any limits on how many fields per form you can have. And yes, you can do a smart multi-select which depends on the values selected in another smart multi-select. No limit here either... except the complexity it brings and has

Jon K October 9, 2018

Thanks for the feedback.
I've drafted a couple test forms to depict this scenario and posted it as a new question:
https://community.atlassian.com/t5/Marketplace-Apps-questions/ConfiForms-How-to-eliminate-duplicate-values-from-a-Smart/qaq-p/911257#M48513

I hope it makes sense and I hope that I'm overlooking some simple solution :)

Jan February 19, 2019

Hello, I am new to Confiforms and looking for exactly this. I will not have trouble with duplicates, as each filter (based on first dropdown) will only have unique values. But I have no clue how to get this done. Is it possible to get above mentioned source code imported? Currently I am trying to get this work with all the different macros but without success. 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2019

You can import the storage format with Confluence source editor app

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events