0

writable if - otherwise calculate from another field

Hello,

I have a numeric field for a measurement in inches, and a second for a measurement in centimetres. When I enter one I would like it to auto-calculate the other. I tried a formula field but that works only if I consistently convert from one format.

So now I have a regular number field set to "writable if" to allow me to enter in one field if the other is null.  I am having difficulty getting the next part (auto-calculate) to work. Should the command be a continuation of "writable if" or entered separately as a trigger? Also - what is the format of the command? 

In summary, if the height_inches field is not null, then the height_cm field = height_inches * 2.54. And then the reverse.

Any advice is welcome. Thank you.

4 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    The one issue I see, if you use the writable if, then once you fill in a number in any field it will fill in the other field and now both fields are not writable. Don’t know if that is how you want it but that is what will happen.

    You can put the appropriate formula in the Trigger after update of each field. The formula is:

    height_cm := height_inches * 2.54
      • Rachel_Brodie
      • 1 yr ago
      • Reported - view

      Fred thank you -

      I am experimenting with the formula you suggested. Using it in the trigger fields (and not using the “writable if” fields at all) an entry in the inches field will convert to cm in the cm field. Technically the cm field is writable, but if I enter numbers it reverts to “0” and there is no result in the inches field.  I was trying  “height_inches := height_cm / 2.54” in the inches field, which did not work.

      Should I be placing both formulas in the triggers fields, with an else statement?

    • Fred
    • 1 yr ago
    • Reported - view
    Rachel Brodie said:
    but if I enter numbers it reverts to “0” and there is no result in the inches field.
    I was trying  “height_inches := height_cm / 2.54” in the inches field, which did not work.

    Sound like you might have mixed up the formulas. I would look to make sure you are putting the correct formula in the correct trigger.

    The trigger in the cm field should have:

    inches field name :=

    The trigger for the inches field should have:

    cm field name :=

    • Rachel_Brodie
    • 1 yr ago
    • Reported - view

    Fred  - I did have them mixed up and thanks to your reply I now have both fields functioning. Thank you so much!

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 4Replies
  • 97Views
  • 2 Following