cascading dropdowns

  • 18 December 2012
  • 7 replies
  • 6 views

Badge +1

Hi,


 


I'm creating forms for incident reporting and have run across something I've not been able to work out. I was recently talking to someone that mentioned I might be best off using cascading dropdowns but I haven't worked out how to accomplish this.


I'm creating a risk matrix so the consequence and likelihood dropdowns need to produce a risk rating.


so Consequence = choices 1-5, then likelihood = 6 - 11


the risk rating depending on the combinations chosen should come out to one of the following;


12   Low


13   Moderate


14   High


15   Very High


 


The result should then populate the risk field.


7 replies

Badge +1

Further to my previous post, same set of forms I need a Dropdown for "Incident Category" under which there will be three categories each of which has a half dozen or so sub categories which then have another half dozen sub-sub categories each.


I would imagine this will require at least three "Cascading" dropdowns as well unless someone has a better method.


Any assistance would be appreciated since I'm relatively new to K2.

Badge +2

Hi,


As I understand, you need to set correct value in the Risk field based on values in Consequence and Likelihood drop-down lists.


If your drop-down lists return numeric values, you can use Expression on the Risk text field with IF (..., ..., ...) condition. For example: if((consequence + likelihood) = 12, "LOW", if(...)) 

Badge +1

Thanks Alexey,


Yes that's what I'm looking for, the output will be verbal but I had figured assigning each value a numeric equivalent would be the simplest way to accomplish it. Being pretty new to K2, and the only person in the company doing any dev with the application it's a big help to get ideas from somewhere. I'll play with this and variations of it.


 


Thanks,


 

Badge +1

Hi,


 


With regards to my second post about incident reporting, I've found some instruction regarding cascading dropdowns in 200.YUL - K2 smartforms: Intermediate.pdf from the learning center, however their scenario is so simplified I'm still banging my head working out how to accomplish it. According to the documentation each subsequent dropdown needs a matching join value, but with every test case I've tried the only way to do that is to make the previous main be a choice in the next dropdown which I don't want to happen, at least not as a visible choice. 


I've substituted simple values but what I need is to have probably 3 separate dropdowns, the selection or content of each subsequent dropdown depends on the selection on the previous dropdown, so in a simplified manner it should come out something like this.


 



 


First dropdown


1     2     3


 


second dropdown (if first =1 then second should be column1, if first = 2 then column 2 etc...)


 


1A     2A      3A


1B     2B     3B


1C     2C     3C


1D     2D


1E     2E


1F      2F


1G


1H


 


again, depending on the result of the above the third dropdown should populate accordingly.


third dropdown


 


1Aa     2Aa     3Aa


1Ab     2Ab     3Ab


1Ac     2Ac     3Ac


            2Ad     3Ad


                        3Ae


1Ba


1Bb     2BA


1Bc     2Bb     3Ba


1Bd     2Bc


1Be     2Bd     3Ca


1Bf


1Bg


1Bh     2Ca


1Bi      2Cb


1Bj      2Cc


1Bk     2Cd


1Bl      2Ce


 


1Ca     2Da


1Cb     2Db


1Cc


             2Ea


1Da      2Db


1Db      2Dc


1Dc      2Dd


1De


             2Ea


1Ea


1Eb


1Ec


1Ed


1Ee


 


1Fa


1Fb


 


1Ga


1Gb


1Gc


1Gd


1Ge


1Gf


1Gg


 


1Ha


1Hb


1Hc


1Hd


1He


1Hf



Badge +2

I did something similar just a few days ago - also a risk matrix. I have several different fields, each value in each field has a different "Risk Rating" - which is a number. Currently I hard coded that numeric value into a rule. So if the user selects X value from Y field, another text box is updated with the proper numeric value (there is an on change rule on field Y). Then, at the bottom, I have another textbox that adds up the numeric value from each of the selections. 


In the next few days I am going to change the numeric values from being hard coded to being in a table, probably a SmartBox SmartObject, and on change I'll fetch what the value should be and update the appropriate textbox. 


I wonder/hope that this helps you?

Badge +2

oh and about cascading drop-downs - i forgot that part. When you use a SmartObject as a data source for a dropdown, there is an option "Filter the data according to another control's value" - then you can setup the join to the "parent control."


Of course, you need a smartobject that has that data so that the join makes sense. I think its what you described in your last post. I found it easier to have a separate table for each drop down, as opposed to trying to create one table to manage all of them.


Then of course, the idea I mentioned before about the numeric values still applies. You can have an onchange rule for each dropdown that updates another text box with a value. You can hardcode the value into the rules with several "if value =" statements, or you can save the numeric value into the table and fetch it that rule through the smartobject.


 

Badge +1

Thanks, in order to do this the way the business wants I may end up having to create a series of false joins in order to fit both the business requirements and the sql logic. I'm still working on it.

Reply