Jump to content
  • 0

Case with formula


KyleMcAfee
 Share

Question

Good afternoon.  Very NEW to Caspio and having a hard time with a formula.  Please review the formula below and let me know what I am doing wrong.

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

 

Fields Used:

unit_of_measure is a list field with US Standard and Metric as the list

weight is number

weight_lbs is number

 

Any help would be greatly appreciated.

Kyle McAfee

812-416-8964

Kyle.McAfee@BOSScrane.com

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @KyleMcAfee - May I know the reason why do you choose the List field for unit_of_measure? Are you planning to save multiple data in one single field? 

At this time, List fields cannot be used in Charts, Pivot Tables, Grouping, Aggregations, Formula fields, and Calculated fields.
https://howto.caspio.com/tables-and-views/data-types/list/ -> Additional Notes
 

What error are you receiving?

Link to comment
Share on other sites

  • 0

I would like the user to be able choose metric or US standard before they enter numbers for weight and size.  but I want the system to show only us standard for outputs on reports.  When user chooses metric, I want the system to show us standard weight in field weight_lbs.  I thought maybe the list - string field type was wrong choice but I thought it looked like the closest field choice from the available field types.  All the errors always show "syntax error at (."   What is best way of doing what I am trying to do?

Kyle McAfee

Kyle.McAfee@BOSScrane.com

812-416-8964

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...
 Share

×
×
  • Create New...