Can this program do calculations? -...

User 2307824 Photo


Registered User
52 posts

Hi Prism, Thanks for you help.
I think i might have confused some in what i was trying to say here.
you'll notice there is 2 lots of code the first is the html style code that would use to create a drop down select box. The second is the coffee cup way of creating a drop select box.

The first lot of code actually uses a value field, that could be easily use for an amount and then for calculations. The coffee cup code however uses the description in the value field, so this would make it very hard to use for math type calculations.

Here the first example
<form method="post">
<select name="Select1">
<option value="46">john</option>
<option value="89">brad</option>
</select></form>

so initially we set the form method to "post", we then give the select box a name "Select1"
after that we then assign a value "46" with a description of john and so on. This is the way you would create a select box in html code if you were using something like m/s expression v4

However in coffeecup we do it more like this
div class="fb-dropdown">
<select id="item6_select_1" name="NFA" data-hint="">
<option id="item6_0_option" value="None" selected>
None
</option>
<option id="item6_1_option" value="1 - 20 People $300">
1 - 20 People $300
</option>
<option id="item6_2_option" value="21 - 50 People $400">
21 - 50 People $400
</option>
<option id="item6_3_option" value="51 - 100 People $500">
51 - 100 People $500
</option>

Ignore the decriptions for the moment. but essentially this does the same thing but only in coffeecup
Both are dropdown boxes except CC assigns the description to the value field as well. If CC decided to change the way it completed the task it would make old forms incompatible with new software.

As you rightly said due to the way the value is currently passed on it makes it very hard to do anything with it. the only option would be use other statements such as some conditional statements to decide which option had been selected then assign a separate variable with a specified value that is dependant on the item selected.

The problem that i was trying to highlight is the way the code is written in CC, that the value fields are used differently to most other html form code. which means it will be very hard for the CC team to get around this in the newer versions of the form builder without creating a situation where old forms are not directly compatible, ending in a total rewrite of all the forms.
User 464893 Photo


Ambassador
1,611 posts

I had a look at CC's php and accepted that they must have a reason and if I needed a simple addition I just used the output. They produce what they promise. I accept that as their developers are better programmers than I will ever be. But I do not know enough to believe I can't achieve anything I want.

I do not think that WFB will ever include that much logic other than to do more selection within itself.
If I were you with that requirement and finding that WFB cannot give data in a form that makes later calculations easy, I would create a form manually to suit and knock up the php to give me what I want.

I am not an expert, its only a hobby with me but I bet if you state what you want I can come up with a method. Plain calculations no worry's, Calculus another story. Been over 40 years since sweating over that.
One approach I can see. Output to a csv file download it and feed it to a Spreadsheet/ Access macro and use that. It all depends on the volume of submissions.

Anyway I love a challenge so if you want my input just ask. I have a weird way of solving problems that has not failed me yet. Impossible! no such thing.
The Guy from OZ


User 2307824 Photo


Registered User
52 posts

I like your way of thinking Prism. But with both of us being from Australia, then its easy to see why you would like a challenge. I think most Aussies do.

Yes agreed they must have a reason for using it the way they have. But I, like you, are no where near their skill. The last time I wrote anything for a computer honestly was when we still had bulletin boards and the net really didnt exist in any form even remotely close to what we have today.
A simple addition is all that is needed in my case. dont even talk to me about calculus. If i cant solve it by adding, subtracting, multiplying or divide or by using pythagoras theorem, then forget it it cant be solved.lol.

I think you are right about the redesign. I have a heap of stuff to do it in. So i will give it ago and when i get stuck i'm sure you will hear me a calling...lol
User 464893 Photo


Ambassador
1,611 posts

Anyway don't keep it all to yourself, how about letting a fellow countryman get his sticky fingers into it and have a bite. What you seem to want can be done by redirecting to a php file in settings. If you get stuck send a csv file and what you want calculated. With me I guess it is ego, self praise and improve the fit of my Akubra.
Having another look at the example you gave there is a value and some information as the field. All this can be extracted and put in a style that can have math applied and reported.

The trouble is I do not have those sort of problems as what I do is mainly just for me, I am not lucky enough to have a real brain teaser to chew over. There was a time.... but nothing lasts. That is why I am so keen in getting involved now. There is nothing that stirs the endorphin's like feeling your brain buzz juggling endless possibilities. I do not get that opportunity anymore. Every application I decide to create is already laid out in front of me like tracing a picture.
The Guy from OZ


User 139605 Photo


Registered User
83 posts

Hey All, I know this is an ancient thread, but it's been very helpful. Thank you.

I have one question. I am doing a very large form with over 400 items. And Eric's method works well for each line total, but can anyone help me with what I would do, maybe what code to enter for a final "Total" field at the bottom of the form that would total all the line totals, so that my client could get a grand total at the bottom as well.

Any help would be greatly appreciated!

~ Jackson
User 187934 Photo


Senior Advisor
20,190 posts

Which example of mine were you looking at Jackson?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 139605 Photo


Registered User
83 posts

Hi Eric. It was this one here: http://ericrohloff.com/coffeecup/ccforu … uspercent/

I just need to have each line totaled and then a grand total field at the bottom that totals all the line totals. I have the line totals working fine, thanks for the code help, now it's just about getting a Grand Total field at the bottom.

Thanks for checking in Eric. I appreciate any assistance you can give :)
User 187934 Photo


Senior Advisor
20,190 posts

If you have published your form can you share a link?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 139605 Photo


Registered User
83 posts

Hi Eric, I haven't published it yet, I'm still building all the lines :(
User 187934 Photo


Senior Advisor
20,190 posts

Post back when you do. It's faster if I see what your actually doing.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.