Conditional default values

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I see where I can set a default value for a field, though I would like it so depending on the chosen [Activity Type] the default value for [Time Logged] is changed. So for example, [Time Logged] defaults to 0.05 for when [Activity Type] equals email, but defaults to 0.1 when [Activity Type] is phone call. Is it possible to add logic to the default value?
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,928 Points 50k badge 2x thumb
If the data entry is on a form, then you can have a form rule.

When [Activity Type] is email
change
[Time Logged] to 0.05

and then a duplicate of that for the other one as a separate Rule.
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
Mhmm, I had done this, the only thing is now I need to make the rule for each type, while I guess it is a little messy, it will work.

Thank you!
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,928 Points 50k badge 2x thumb
Well, instead, have a single formula to calculate the default value.
Then have a single rule that says if the [Time Logged] is blank, change it to the value in the field [calculated default value].

Be sure to put that calculated value on the form  in a hidden field or section to be sure that the form rule sees changes to the calculated default value after the form is loaded.
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
Yes, this seems to be a cleaner approach,
Thank you!