0

How do I make a multiple choice box dependent on the value of a specific field?

I have a table with countries and which continent they are on.  In a separate table, I have a list of hotels around the world, at the moment I can select the country name and the continent appears - all good so far.  Now I need to add regions to specific countries.

 

For example, if I selected "Kenya" then I'd like a drop-down combobox with a list of applicable regions to Kenya.

 

Please help...

11 replies

null
    • NIOXUS
    • 5 yrs ago
    • Reported - view

    There are two ways to accomplish what you are trying to do.  The first option is a construct called Cascades; In this case, cascading Choice fields.  You create and populate with choices all of the regional popups (Choice Fields) and then use the "Display Only If" option to display the appropriate regional selection/choice field based on the selection in the previous field.  For example, if the user selects "England" as the country, the system displays the England Regions Choice field.  If the user than selects United States, the US Regions Choice field appears.  You can control the appearance/invisability of each choice field using code 'Country Field' = n where "n" is the number of the selection.  So if England is option 1 and USA is option two, to display the England Regions display choice field the formula is Country = 1.

     

    The second option is to create a table of regions with two fields.  The first field is country and the second field is region.  You would then link to this table to enable the user to select the region, but you would restrict the choices by using the Constraints parameter for reference fields.  Using this parameter, you would specify the name of the country selected in a "Country Selection" field and then use that selection to restrict, or Constrain, the values (Regions) presented in the popup link to only those regions in that country.

     

    You can get templates of both of these solutions in the member portal at www.ninoxus.com.  Membership is free and the templates are free.

    • Mconneen
    • 5 yrs ago
    • Reported - view

    I would create a datamodel like this

    dataModel

    Which provides a simple view like this

    SimpleView

    You can now use this relationship on a data entry form.

    DataEntryForm

    For the Country constraint... use

    regionConstraint

    Likewise...  for the region.. 

    regionConstraint2

    • Nick.1
    • 5 yrs ago
    • Reported - view

    Thanks everyone. 

    Mconneen - yours was the best solution for me - works like a charm, have more questions - but will add another post.

    • Simon_Hall
    • 5 yrs ago
    • Reported - view

    Hi Mconneen,

    I have a very similar problem which I'm sure that your solution will solve, but as a distinct newbie, I can't get my head round the differences.

    I have a table Pubs which contains the pub name and address and (crucially for this problem) Town, County and Country fields. I have a separate table likewise with Town, County and Country fields which I was hoping to use as a lookup, thus when I entered the town name in the Pubs table it would offer me only the counties where that name exists and then, upon selection, the county field would only offer me the countries where that county exists. There could be more than one of any of these 'offers.'

    I can sort of see where you're going with your solution but I can't imagine how I might get a table model to look like yours with the 'nested' continent - country - region arrangement or how I might then join them all together in a way that would actually work.

    Thanks in advance for any help

    • Mconneen
    • 5 yrs ago
    • Reported - view

    @Simon, 

    You seem to be working the model in opposite direction.    You are starting at the Town (lowest level) and moving up .. County .. then Country (highest level)...  This implies a different sort of relationship.. a many to many .. Meaning one Town may be in many Counties.. and a County may have many Towns.  To do this, you need to build an associative relationship (aka a table in between) between Town and County... and County and Country... then work the constraints in opposite order of above. 

    When I get more time.. I will try to post a model of it.. 

    • Simon_Hall
    • 5 yrs ago
    • Reported - view

    Thanks Mconneen. It's that way round because, in data entry terms, you enter town first, followed by county, followed by country, like an address. I look forward to your words of wisdom. Thanks again

    • Mconneen
    • 5 yrs ago
    • Reported - view

    @Simon.. Oh no... if you are looking forward to "words of wisdom" from me.. I am afraid it may be a while.. LOL. 

     

    Another strategy I have been playing with is to leverage the "location" object.. which pops you out to a map search.. you can then parse the return address.  It does not give you the County.. but that could be derived based on lat / long perhaps. :)   Just something fun..  not very good for heads down data entry. 

    • stefaan_verschelde
    • 3 yrs ago
    • Reported - view

    Hi,

    As I am new to NINOX and I am an experienced Fikemaker user, I would like to create a table "Installed Base" with analysers from a certain Business Unit, a Supplier & an analyser to select. As there are lots of them I need to constrain the full list of analysers so I am able to pick my selection out of a few.

    I have tried this in several ways even tried the way above, but do not seem to manage it.

    Could you please help me with the data-model and with the way to do it?

    Many thanks

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view
    • stefaan_verschelde
    • 3 yrs ago
    • Reported - view

    Hi Steven,

    I cannot find the file. Would youy please be so kind to send me the direct link?

    Many thanks

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

Content aside

  • 3 yrs agoLast active
  • 11Replies
  • 4323Views