Is it possible to create such a calculator?

By: Alexander Schneider | Asked: 01/13/2023
ForumsCategory: How-toIs it possible to create such a calculator?
Alexander Schneider asked 2 years ago
Hello,
I'd like to know if it is possible to create this calculator for 3D-printing.
I have, in fact, a multi-step calculation.

The first step is to calculate the volume (cubature) of the product (shape) in cubic santimeters (V). Depending on the chosen shape (bar, cone, cylinder), field groups are opened with measurement fields for the corresponding shape (for a хarallelepiped - length, width, height; for a cone - height and radius of the base etc). The volume of the product itself does not participate in the cost, of course.

In the next step, the material is selected and a multiplier factor is set, depending on the volume previously calculated. For example, for material No.1:
If V < 50, then K1 = 25
if 51 < V < 100, then K1 = 15
If 101 < V < 500, then K1 = 12
For material #2:
If V < 50, then K1 = 35
if 51 < V < 100 then K1 = 25
if 101 < V < 500 then K1 = 22
etc.

The third step is to select the "urgency" parameter, which sets the K2 coefficient. By default, urgency is not selected and K2 = 1. If urgency = 1, then K2 = 2

Cost = V * K1 * K2.

How feasible is it to implement such a formula with your calculator?
1 Answers
Victor Font answered 2 years ago
Complex calculations aren't an issue, but sometimes you need custom code to execute the formulas. I've coded some very complex future value formulas for a dynamic ChartJS graph driven by Formidable data and configuration tables. Any formula that can be coded to produce an accurate result can be used with Formidable. Whether to use jQuery, PHP, or a combination of both depends on your requirements, which aren't clear from your post.
Victor Font replied 2 years ago

I saw in the Facebook Group where you solved the problem in the default value field. In case you need the results rounded, use the frm-math shortcode to implement math functions. See this Formidable Knowledgebase article: https://formidableforms.com/knowledgebase/math-calculations/#kb-where-can-the-math-functions-be-used/

Victor Font replied 2 years ago

One more thing, if you want to number rounding in the browser, please see this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right