This topic is locked

show sql calculated values edit page - No Value Showing

6/2/2014 1:00:23 PM
PHPRunner General questions
E
emorials author

show sql calculated values on the edit page and view pages for custom views
I am using the following code in the Query editor. The sql code is making the calculations as shown in the results tab. However the field for the subtotal isn't showing any data and the calculation isn't showing in the DB.
My question is on how I can calculate the data in the SQL editor and show the result of the calculation in edit page of a custom view for that user? Do I have to create an before page added event / before page updated event?
Here is the SQL code:
Thank you for any reply's. I appreciate it.
SELECT

ID,

Disposition Choice,

Disposition Vessel,

Disposition Merchandise,

Final Internment,

Memorial Choice,

Memorial Location,

Embalming Services,

MerchandiseTotal,

EmbalmingTotal,

InternmentTotal,

TotalGuests,

MemorialCostPPTotalGuests AS MemorialCostPP,

Pre Burial Family Transportation,

PreBurialFamilyTransportationCost
NumberDays1 AS PBFTT,

PostBurialFamilyTransportationCost*NumberDays1 AS PoBFTT,

Place of Death Transportation Type,

PlaceofDeathTransportationCost,

PostBurialFamilyTransportationCost,

MGCT,

DispositionBaseCost+MerchandiseTotal+EmbalmingTotal+InternmentTotal+DonationAmount+CreativeCost+PBFTT+PoBFTT+MemorialCostPP AS subtotal2,

EstimatedFuneralCost,

NumberDays1,

Numberdays2,

Donations,

DonationAmount,

COLA,

DateOfBirth,

UserID,

CreativeFundingNeeds,

CreativeCost

FROM plan

Sergey Kornilov admin 6/3/2014

Values calculated in SQL are not saved in the database. That is the whole point of those calculations - you can show users something that is not in your database.

E
emorials author 6/5/2014

I know that, but if you show the value on the edit page in a form field the calculation will be entered into the database. Just want the calculated value to show the same as it does on a list, view page to the user.

Sergey Kornilov admin 6/5/2014

You cannot show calculated field on the Edit page and you cannot save it to the database, because there is no such field in the database.

F
F5447 6/9/2014

You need to create a field in the database, says: subtotal2
For your select statement, it will shows calculated value, and then you need to <edit> the page and after that <save> the page in order to "insert" the calculated value back to database.
Without the process of <edit> and <save>, you will not "insert" the value into database.