Highlighted

Simple Calculations - Any Samples out there?

Avatar

08-01-2009

I've created a simple form with inputs for Cost & Profit. I added two fields for Percent Profit and Price but want those to be calculated from the Cost and Profit entries. The calculation is simple and would be a no brainer in Excel, but I can't figure it out using the Help file alone.



Percent Profit = Profit / Cost

Price = Profit + Cost



I'm sure I can get it if I could see some examples of simple forms that do calculations. Or even a detailed walk through would be nice. The Help file would be so much more "helpfl" if it showed a few pictures on where some of these functions are hidden. lol...

Thanks.

Replies

Highlighted

Avatar

Avatar

Thomas_McConnac

Avatar

Thomas_McConnac

Thomas_McConnac

08-01-2009

You need to pick the right event for you (I would suggest change or exit in the input fields) to trigger the calculation.



Then the magic word you're looking for is rawValue



percentField.rawValue = profitField.rawValue / costField.rawValue;



Hope this helps,



Tom
Highlighted

Avatar

08-01-2009

Sorry, but I'm new to this application and have not idea what you just said... ;(



Would appreciate a bit more detailed walkthrough. I have the form built... now what? Click on an object.... etc.
Highlighted

Avatar

09-01-2009

What he typed:

percentField.rawValue = profitField.rawValue / costField.rawValue;



This assumes that the 'name' (under the 'Binding' tab on the object palette) for the numeric field used to enter the cost is "costField", and the one used to enter the profit is named "profitField".



And then that the name for the result is "percentField"



".rawValue" refers to the, well, raw value of whatever is before the dot--in javascript. For instance, if you entered 2 into the profitField, it's rawValue would be 2.



If you don't mind posting your email, I'll send you a sample.
Highlighted

Avatar

09-01-2009

Thanks Zero. I'd like to see an example of this. What it sounds like is I bind a name to each field I want to use in the calculation.



1. So under the "Binding" tab I enter a name for each object who's value is used or calculated.



2. Then in the object I want calculated I set its value type to "Calculated-Read Only."



3. Now I'm lost... where do I enter the formula? I tried entering "ProfitPercent.rawvalue = Profit.rawvalue / TotalCost.rawvalue;" in the "Default Binding" but that gave me an error "failed to generate...see log tab/" I love that... now I can't find the log tab.



It took me hours just to find the Object tab....heh heh.



My email address is Jim19596 "at" hotmail.com.



My next question will be "How do I export the data from the form into an Excel spreadsheet row?"