How do I set a Confiform smart multi-select field to the value of 6 other fields
Asked by VD:

Hello Atlassian community

I've built a form with a smart multiselect field and 6 other status fields. When the status field s1 is set as 'Applicable', I want a specific country (say USA) to be populated in my smartfield. When status field s2 is set as 'Applicable', the smart field should have another specific country (say UK) added to it. When status field s3=Applicable, smart field should have yet another country (say France) added to the list, and so on.

I considered using rules to populate my smart field - that was a disaster! Imagine the number of rules I must write to get all combinations of my 6 status fields! And just to add to the complexity, the number of status fields could increase and more countries get added.

Then I thought - why not set the country associated with each status field in separate fields, and then just add all these countries together into the smart field. Again, when I tried that, the smart field just takes the first field value and ignores the rest of the countries. And they have to stay as countries (and not text/formula) as these are used as input in anothr form.

Can anyone help me with this quandary?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Just to clarify...

So you have form with countries which you use through the smart multi-select field and you have 6 status fields which should filter or set the values in the multi-select field based on the selections made in the status fields?

What are these selection/filtering rules? How many of these do you have? Could you tell why you have so many status fields and why this number may grow in the future?

Alex

comments: author: VD
body: Correct, I have a form with a smart multi-select field configured to accept multiple countries. And the countries are to be populated based on the selections in the status fields.

The selection rules could be like:

1. If Status field s1= Applicable, then add country 'USA' to smart field, OR if s1=Global, then add all countries to smart field. Else, don't add anything.
2. If Status field s2= Applicable, then add country 'UK' and 'France' to smart field, OR if s2=Global, then add all countries to smart field. Else, don't add anything

This is originally a spreadsheet we are trying to convert to a confiform form. The status fields represent countries that have special domestic tax rules applicable when the record has those countries indicated. Which is why the number of such fields might increase - as we bring in more tax codes, the number of status fields will increase. but, the actual values held as statuses will be constant, and won't change.

Hope this clarifies.


author: Alex Medved _ConfiForms_
body: I am still confused about the data model, but OK.

So, what you need to know is that you can apply filters on the field and that is what you have to do here.

<https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-ApplyFilteronafield>

In other words you put filtering rules to filter OUT the countries you dont need based on the selection in your status fields (I am still confused what the rules are and how complex these are -\> how many rules you have)

Also some example on how to use the mention rule

* [Using ConfiForms Field Definition Rules macro to reduce number of choices in a dropdown field based on the value selected in another field](https://wiki.vertuna.com/display/CONFIFORMS/Using+ConfiForms+Field+Definition+Rules+macro+to+reduce+number+of+choices+in+a+dropdown+field+based+on+the+value+selected+in+another+field)
* [Using Field Definition Rule to filter choices in another field](https://wiki.vertuna.com/display/CONFIFORMS/Using+Field+Definition+Rule+to+filter+choices+in+another+field)
* [Using apply filter on field rule](https://wiki.vertuna.com/display/TEST/Using+apply+filter+on+field+rule)

Alex


author: VD
body: Thank you Alex. The below helped me resolve another issue I'd been facing and gave me a new idea :)

[*https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-ApplyFilteronafield*](https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-ApplyFilteronafield)

*In other words you put filtering rules to filter OUT the countries you dont need based on the selection in your status fields*

For now, I've used a kind of workaround to solve my problem. Since each of my status fields represent a country, I created country fields corresponding to each of the status fields and populated them first. So status s1 = Applicable meant that s1country field will be set as 'US'. Status field s2=Applicable meant s2country field = 'France'. Then I just concatenated all these values into the main field where I wanted all the different countries populated. Saved me writing a million different combinations of rules!


Tags: confiforms

confluence-server

server