0

Setting Up Conditional Default Values?

Hi all,

I'm wondering if it's possible to set up conditional default values for choice fields.

For example:

I have three drop-downs, Payment 1, Payment 2, and Payment 3.  Each has the following choices: Paid in full, To be paid in cash, To be paid by credit.

I have a fourth drop-down, Method of Payment, with the following choices: Cash, and Credit.

I would like to be able to select, for example, Method of Payment: Cash, and have the Payments 1-3 drop-downs automatically flip to, "To be paid in cash."

However, I will of course need to be able to "overwrite" the "To be paid in cash" choice, as once the customer pays, I'll need to be able to select "Paid in full."

I'm convinced this had to be a default value, since I would also like it if changing the Method of Payment didn't change the value for previously "overwritten" Payment drop-downs.  Here's what I mean:

Let's say we get this working and a Method of Payment is set to "Cash."  Payments 1-3 will now read, "To be paid in cash."  The customer then pays Payment 1.  I switch Payment 1 to "Paid in full," and Payments 2-3 still read, "To be paid in cash."  The customer changes his mind and decides that his remaining payments will be by credit.  I then would change the Method of Payment to "Credit."  What I would want to happen would be Payments 2-3, which are still sitting at their default values, to switch to, "To be paid by credit."  I would NOT want Payment 1, which I have manually overwritten by selecting the drop-down option of "Paid in fulll" to also revert to "To be paid by credit."

Is this possible at all?  Would it be a default value question, or some sort of placeholder, or something like that?

Also, I'm relatively new to Ninox and a complete n00b when it comes to coding and formulas, so if this is possible, it would be amazing if you could spell out the steps in the most layman's instructions possible XD

Thank you!

2 replies

null
    • info.4
    • 5 yrs ago
    • Reported - view

    Edit: Better spacing.

     

    Hi all,

     

    I'm wondering if it's possible to set up conditional default values for choice fields.

     

    For example:

     

    I have three drop-downs, Payment 1, Payment 2, and Payment 3.  Each has the following choices: Paid in full, To be paid in cash, To be paid by credit.

     

    I have a fourth drop-down, Method of Payment, with the following choices: Cash, and Credit.

     

    I would like to be able to select, for example, Method of Payment: Cash, and have the Payments 1-3 drop-downs automatically flip to, "To be paid in cash."

     

    However, I will of course need to be able to "overwrite" the "To be paid in cash" choice, as once the customer pays, I'll need to be able to select "Paid in full."

     

    I'm convinced this had to be a default value, since I would also like it if changing the Method of Payment didn't change the value for previously "overwritten" Payment drop-downs.  Here's what I mean:

     

    Let's say we get this working and a Method of Payment is set to "Cash."  Payments 1-3 will now read, "To be paid in cash."  The customer then pays Payment 1.  I switch Payment 1 to "Paid in full," and Payments 2-3 still read, "To be paid in cash."  The customer changes his mind and decides that his remaining payments will be by credit.  I then would change the Method of Payment to "Credit."  What I would want to happen would be Payments 2-3, which are still sitting at their default values, to switch to, "To be paid by credit."  I would NOT want Payment 1, which I have manually overwritten by selecting the drop-down option of "Paid in fulll" to also revert to "To be paid by credit."

     

    Is this possible at all?  Would it be a default value question, or some sort of placeholder, or something like that?

     

    Also, I'm relatively new to Ninox and a complete n00b when it comes to coding and formulas, so if this is possible, it would be amazing if you could spell out the steps in the most layman's instructions possible XD

     

    Thank you!

    • Database Consultant
    • Kirkness_Associates_Ju
    • 5 yrs ago
    • Reported - view

    This is entirely possible - but it's not really a 'default value' scenario but rather a value to be set in one field when another field is changed. This is done by creating a Trigger After update for the Method of Payment field - something like:

     

    if text('Method of Payment') = "Cash" and 'Payment 1' = null then
        'Payment 1' := text("To be paid in cash")
    end

    This goes in here:

     

    Screenshot 2019-05-01 at 15.31.11

     

    In this example, the code will update Payment 1 as long as it is empty (thats what null means) when the user selects Cash as a Method of Payment. The text 'functions' are used for clarity because Choice fields are stored as numbers and this enables you to refer to the text instead - it's simpler to read.

Content aside

  • 5 yrs agoLast active
  • 2Replies
  • 2096Views