Calculated Fields (Is it possible?)

5 posts by 3 authors in: Forums > CMS Builder
Last Post: October 5, 2008   (RSS)

By jamtc - October 3, 2008

Hi there!

I want to do some like this...
  1. Field3 = Field1 + Field2 or;
  2. Field3 = (Field1 * Field2) / 4


Then I'll disable Field3 for access because it is an (Automatic Calculated FIELD)

Is it possible ?

Many thanks...
[pirate]

Re: [Dave] Calculated Fields (Is it possible?)

By jamtc - October 3, 2008 - edited: October 5, 2008

Hi Dave!

How can I do that?

I have the following situation:
The Fields
--------------------
Field1 (Name): Mr. T
Filed2 (Value1): 25.00
Field3 (Value2): 2
Field4 (Value4): (Field2 * Field3) = (I want to show 50.00)
How can I do an action to do this calc for me after clicking the "Save" button of the record?
How is the php code to do this action?

Can I do this for all fields (Field4) in the table with any kind of "Batch Process"?
How can I do and show this simple calc?

Many Thanks Dave...

Re: [jamtc] Calculated Fields (Is it possible?)

By Kenny - October 3, 2008 - edited: October 3, 2008


Here is some simple math for you:

Get one field to auto add itself to another field

<?php echo number_format($record['number1'] + $record['number2']) ?>


Get one field to auto add itself to a fixed number

<?php echo number_format($record['number'] +500 ) ?>

Get one field to auto multiply itself to a fixed number and show two zeros after the decimal place

<?php echo number_format($record['number'] * 5, 2) ?>

The ", 2" tells it to always show 2 decimals. This will also add thousands separators. So one million will display like this: 1,000,000.00


Get the idea? Post back if there is one that you can't figure out based on this information.


Kenny

Re: [sagentic] Calculated Fields (Is it possible?)

By jamtc - October 5, 2008 - edited: October 5, 2008

Ok!

I got the idea...

Many thanks...

[;)]