Jump to content
  • 0

Case with formula


KyleMcAfee

Question

What is wrong with this formula?  Very new, so any help will be appreciated.

CASE
 WHEN [@field:unit_of_measure] = 'Metric' THEN [@field:weight_lbs] = 2.204 * [@field:weight]
 ELSE [@field:weight_lbs] = [@field:weight]
END

***********

[unit_of_measure] is list string

[weight] is number

[weight_lbs] is number

Need to save [weight_lbs] with the weight after converting from metric if needed, if not needed then just save the weight to [weight_lbs]

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

MeeKeee,

Each record will ask user if they want to enter data as US Standard or Metric.  If they choose Metric, then I want the database to canvert the metric number to us standard and save results into new field as weight_lbs.  This needs to be done for Langth, Width and Height as well.  The system will convert the MM to Inches and save in length_inches.  But some users will be using us standard as input so those numbers will not be converted but simply safe the same amount into weight_lbs or langth_inches.  From your other reply sounds like field type list string is not the field type I should have used.

Link to comment
Share on other sites

  • 0

Hi @KyleMcAfee, to answer your question, it would be better if you will use a text(255) data type since you only have 2 options (metric or US standard) and you just need to choice between the two, right? With that, configure your DataPage to have a dropdown option and just input the two specific options on the custom values of the dropdown option.

image.png.62198f58d1baffb06b0b6724919390d1.png

And for your calculation, you may try this:

CASE
 WHEN [@field:unit_of_measure] = 'Metric'

THEN

2.204 * [@field:weight]
 ELSE

 [@field:weight]
END

 

I believe, you want to store the result of the calculation above in your [@field:weight_lbs], right? Then if that is the case, you can make your [@field:weight_lbs] as a calculated value and put the formula above. I hope that helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...