0

Auto-populate a predetermined Number in a field depending on a choice made in a combo-box

How do I Auto populate a predetermined number in a field that will change depending on what I choose in a different combo-box. 

ie. Combo-box has these options  1. Purple Sweater    2. Pink Sweater   3. Red Sweater.

When I choose the Purple sweater id like a different function box ( named Cost ) auto populate $5.00... Pink sweater auto populates $10.00 ..... Red is $15.00

Also if I choose more then 1 sweater I need the Cost field to auto populate a combined total 

purple sweater and pink sweater should auto populate $15.00 and so on depending on whatever choice is made from the combo boxes..

 

thanx please help me !

5 replies

null
    • Fred
    • 2 yrs ago
    • Reported - view

    Hi Steve

    So you have a multi-choice field with 3 choices. Make another formula field and put this in the formula:

    number(multichoicefieldname)
    

    As you make your choice you will see different numbers (1,2,3,4,5,6,7). What is happening is that Ninox assigns a value (not the number you see when you setup the field) to each choice (1, 2, 4). Then adds up the values depending on choice selected.

    So to answer your question, for 3 choices, you can do something like:

    switch multichoicefieldName do
    case 1:
        5
    case 2:
        10
    case 3:
        15
    case 4:
        15
    case 5:
        20
    case 6:
        25
    case 7:
        30
    end
    

    So we have taken all possible combination and assigned a value to display depending on the choices made in your multi choice field. This will not scale very well so if you need to handle more choices then another solution will need to be offered.

    Hope this helps and let us know how it goes.

    • Steve_Sharp
    • 2 yrs ago
    • Reported - view

    Thank you that really did help but its a little more complicated .. What do I do if I have multiple combo-boxes...

    Ie ... blue shirt  $10.00 Pink shirt $15.00 Yellow shirt $20.00 in one combo box  and then those sweaters in another one ...

     

    TBH here i have a cascading combo box thing going on with lots of possible outcomes ... plus I need to be able add multiple combo boxes presets together if needed 

    • Fred
    • 2 yrs ago
    • Reported - view

    Are you part of the Ninox Webinar EN 2022 cloud team? If not then email support@ninox.com and ask to be added.

    Then look at Cascading DC Fields DB for some great work by RoSoft_Steven Rooryck .

    For something like this I would recommend that you use a 3rd table to track the selection.

    • Steve_Sharp
    • 2 yrs ago
    • Reported - view

    a third table ? 

    • Fred
    • 2 yrs ago
    • Reported - view

    You need a 3rd table to track the choices selected from the different multiple choice fields.

    Can you let us know what your DB structure looks like, i.e. table names, table relationships, important field names?