KyleMcAfee Posted February 25, 2022 Report Share Posted February 25, 2022 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 Quote Link to comment Share on other sites More sharing options...
0 Kurumi Posted February 25, 2022 Report Share Posted February 25, 2022 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? Quote Link to comment Share on other sites More sharing options...
0 KyleMcAfee Posted February 26, 2022 Author Report Share Posted February 26, 2022 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 Quote Link to comment Share on other sites More sharing options...
0 NailDyanC Posted February 26, 2022 Report Share Posted February 26, 2022 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. 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. Quote Link to comment Share on other sites More sharing options...
0 KyleMcAfee Posted February 26, 2022 Author Report Share Posted February 26, 2022 Yes, thank you. I will give that a shot. Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted February 27, 2022 Report Share Posted February 27, 2022 Just to add with the previous responses, here's the link to function reference from Caspio: https://howto.caspio.com/function-reference/. You'll find an example of Case When condition here. Cheers! Quote Link to comment Share on other sites More sharing options...
Question
KyleMcAfee
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
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.