Skip to main content

Hi K2 experts,

 

I am working on a task and stuck on it. Could you please help me out for this.

 

Scenario : I have two dropdowns with names "Question" and "Operator". 'Question' Dropdown is mapped with "Question" SMO. "Operator" Dropdown is mapped with "Operator" SMO. There is no mapping between "Question" and "Operator" table.

Now requirement is on particular question, particular 'operator' values should be populated.

 

For Example : if Question is "is this valid", then 'operator' values should be filtered and displayed as "Equal to" , "Not Eqal to".

 

Operator values are as "greater than", "Equal To", "Not Equal to","Less than" etc.

So on change of question dropdown, operator values should be filter and popoulated.

 

Please assist me for this.

 

Thanks & Regards,

Vivek

 

 

Good Day VG


 


First you would need to identify which question should display which operator as we already know that a particular question has a particular operator value.


So lets use the example that you gave. If the question is "Is this Valid?" then the operator should populate the operator drop down list with "Equal to" and "Not Equal To".


 


To allow the operator to return the correct value it would first need to filter the value upon a re-population of the operators dorp down list after a condition check agains the questions drop down list has been identified as true. For example: If the question is "Is this Valid?", then on the questions dropdown list we would need to check if the dropdown list is equal to "Is this Valid?" - this will then validate to either true or false, if it validates to true then the operators dropdown list should be re-populated and a filter should be added to the re-population rule specifying which operators should be made available in the opertator drop down list when the questions drop down list is equal to the question "Is this Valid?", if the question changes this entire condition should be re-executed.


 


Based on the above, please see the following steps in order to configure your viewform with the same solution.



  1. Get setup



  • Create a SmartObject call it 'Questions' with an ID=Autonumber property and an Questions=Text property.

  • Create another SmartObject call it 'Operators' with an ID=Autonumber and an Operator=Text property.

  • Generate a Editable list view for each of the above SmartObjects.

  • Run the Questions Editable List view and add some questions.


  • Run the Operators Editable list view and add the following operators [ Greater Than, Equals To, Not Equal To, Less Than ]


  • Create a Item View and add two drop down lists to the the canvas, configure the first drop down lists Data Source to the Questions SmartObject and the second drop down lists Data Source can be configured to the Operators SmartObject.




  1. Now to add the rules, that will do the check:



  • Since the Dropdowns already have data sources connected to them at this point, that would mean that the views "Initialize" rule would have auto genrated population rule for each dropdown list. You can disable or remove the Populate rule for the Operator SmartObejct as we are going to call it somehwere else. This step is optional depending on if you need the dropdown list to be populated on initialize or not.

  • Add a new rule on the questions drop down list  for when it gets changed.

  •  

  • Add a condition check to see which question is selected


  • Add the Operators populate list control with data rule and add your filters depending on what should be returned when the specified question is selected.




This solution was tested and found to be satifactory based on the request made in this article.



 


Kind Regards


Raymond


 


Good Day VG


 


I have been monitoring this post based on this issue and the solution provided, I noticed that there has not been any further feedback added and wanted to reach out to obtain conformation as to if the solution was able to resolve your issue. Please could you confirm?


 


Thank you


 


Kind Regards


Raymond


Reply