This topic is locked

View fields correctly

10/28/2007 1:27:28 PM
PHPRunner General questions
E
Edgar69 author

as a newbie I hope for any help. Just a simple thing I do not find out.

a table with let's say 4 fields,, fieldA fieldB fieldC and fieldD......... if I get edit, it does and it should show these 4 fields;

but if I view, or print I would like to see a 5th and a 6th field with a result of a calculation, using one or more of the other fields.

Example fieldE = (fieldA + fieldB)*2

fieldF = (fieldE - 10) / fieldC

how can I realize this to see after editing for example

fieldA fieldB fieldC fieldD fieldE fieldF

10 20 2 100 60 25
THX for any help

O
osluk 10/29/2007

I am no expert but you need to add the calculated field to the MySql tab

Ensure you have added the new field to your field list for the pages
Also I noticed MySql did not like using E in a calculation beacuse it is calculated - display is fine

So use fieldF = ((fieldA + fieldB)2) - 10) / fieldC instead of fieldF = (fieldE - 10) / fieldC
Also MySql seems to require the syntax A-B AS C rather than =
Hope this helps

Anyone who is SQL competent feel free to correct or enhance this post.
Cheers Chris

as a newbie I hope for any help. Just a simple thing I do not find out.

a table with let's say 4 fields,, fieldA fieldB fieldC and fieldD......... if I get edit, it does and it should show these 4 fields;

but if I view, or print I would like to see a 5th and a 6th field with a result of a calculation, using one or more of the other fields.

Example fieldE = (fieldA + fieldB)
2

fieldF = (fieldE - 10) / fieldC

how can I realize this to see after editing for example

fieldA fieldB fieldC fieldD fieldE fieldF

10 20 2 100 60 25
THX for any help

J
Jane 10/30/2007

Hi,
you can do it using calculated fields on the Edit SQL query tab.

Here is a sample:

select FieldA,FieldB,

FieldC,

FieldD,

((fieldA + fieldB)2) - 10) as FieldE,

((fieldA + fieldB)
2) - 20)/fieldC as FieldF

from TableName

O
osluk 12/8/2007

Can anyone confirm the correct syntax to display the sum of the following fields as RT
`Merlot_%`,

`CabSauv%`,

`CabFranc%`,

`PetitVerd%`,

`Malbec%`,

`Carmen
%`,
I have used
(`Merlot_%`+`CabSauv%`+`CabFranc%`+`PetitVerd%`+`Malbec%`+`Carmen%`)as`RT`,
I have added RT to the page but no value is displayed though there is data in the fields added.
Cheers Chris

Alexey admin 12/10/2007

Chris,
make sure none of your fields contain NULL (empty) value.