Can I set up a formula field so that a user can overwrite the information when in edit mode?

  • 1
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Can I set up a formula field so that a user can overwrite the information when in edit mode? Another approach would be to set the default value for one field to equal the value of another field.  Is that possible?
Photo of Mary

Mary

  • 240 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
  • 1
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
Yes.  A good use case for this, and the example I'm going to use, is when you have an Item price, but want to have the option to override the list price.

[My List Price] is a field coming from a parent table, or an items table.
[Price Override] is a field that can change the value
[Price] will be the formula field that takes the list price, or take the override price.

[Price] formula would be:

If( IsNull( [Price Override] ), [My List Price], [Price Override])

If you are using text fields, the similar, but use the sign ="" rather than the null:

If( [My Override Text]="", [My Default Text], [My Override Text])
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
.. just a tip.  If you are checking a numeric field to be blank with IsNull, be sure to set that numeric field to not treat blank as null.  There is a field property checkbox for that.
Photo of Mary

Mary

  • 240 Points 100 badge 2x thumb
Thanks.  That is the way I have been doing it.  Was just wondering if there was a way using only one field.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 48,444 Points 20k badge 2x thumb
This can be done with a formula which does that 25% calculation and a form rule

When [Benefits] is blank
Change [Benefits] to the value in the field [Stipend arstinsted]

You will have to have the [Benefits Estimated] field on the form, even if it's in a hidden section.

You can experiment with that rule or else a rule based on
"when the record is saved"
Photo of Mary

Mary

  • 240 Points 100 badge 2x thumb
So I tried
Estimated Benefit = Stipend * 25%

And a form rule that says
If Estimated Benefit is not blank
Then Benefit = Estimated Benefit

However, this doesn't work because Estimate Benefit is a formula field.  If I make it a non-formula field than the form rule works.
Photo of Mary

Mary

  • 240 Points 100 badge 2x thumb
On further testing, it does work for new records added but not for existing records.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 48,444 Points 20k badge 2x thumb
Did you uncheck the box on the form rule at the bottom so that it always fires and not just when the conditions become true?
Photo of Mary

Mary

  • 240 Points 100 badge 2x thumb
Thanks.  Had not done that.