This topic is locked

Display Calculated Field Result

5/19/2020 1:30:59 PM
PHPRunner General questions
C
chrisbee author

I have read about Modifying the Table to include a calculated filed. I do not have access to modify the table.
I have a very simple query
Select

SUM(Table.value/100) as 'DECLARED_VALUE'

From

Database

Where

Date = Curdate()
The SQL Preview works fine
When I BUILD I do not get a result... presumably because there is no place holder for the value
I cannot change the table as I do not have permission.
What other options do I have to display the value of a calculated field?

T
thamestrader 5/30/2020



I have read about Modifying the Table to include a calculated filed. I do not have access to modify the table.
I have a very simple query
Select

SUM(Table.value/100) as 'DECLARED_VALUE'

From

Database

Where

Date = Curdate()
The SQL Preview works fine
When I BUILD I do not get a result... presumably because there is no place holder for the value
I cannot change the table as I do not have permission.
What other options do I have to display the value of a calculated field?



A few thoughts:

  1. Can you create a custom view of the table? I have been able to do this as a custom view and its used on a Dashboard.
    SELECT

    sum(fb_voucher.adult) AS Adults,

    sum(fb_voucher.child) as Children,

    count(*) as vchr_tot

    FROM fb_voucher

    WHERE (fb_voucher.status_code= "IS") and (fb_voucher.collect_deliver = "Home Delivery") AND (fb_voucher.order_status = "RQ")
  2. Use CONCAT to create a temporary field: e.g.

    SELECT

    FB_id,

    first_name, last_name, ptnr_fname, ptnr_lname, accom_type,

    concat(" ") AS NumData,

    concat(" ") AS BldgData,

    street1, street2, area, town, postcode

    FROM fb_person
    The CONCAT's get data fields defined or included in the $values array, which means you then have something to work with in events and display on forms.
    In this particular example I wanted to format the layout of an address field according to whether address was for a House, Flat or Hotel i.e. the type of accomodation.

Sergey Kornilov admin 6/1/2020

What does it mean 'there is no place holder for the value'?
What database do you use? Is this your actual SQL query?