This topic is locked

Question about mileage and two tables

3/8/2019 6:52:03 AM
PHPRunner General questions
Tandy author

I have two tables. The main table is escort_mileage and the details is extra_mileage. I have them set up good.
Under the extra_mileage table I have a record of miles. Then that gets totaled at the bottom of the page for total extra miles.
In the main table escort_mileage I have start_odometer and end_odometer records. With that I have a Query of: end_odometer - start_odometer as mileage. That Query gives me the miles ran.

What I would like to find out is can I have the total extra_mileage get listed on escort_mileage then add the two in a full total mileage?

So in extra_milage I would have miles ran, + extra miles, = total Miles
Hope I explained this right. Thank you for any help on this.

James Tandy

M
Mark Kramer 3/10/2019

I would look at the DAL function for inspiration. It will all you to pull data from fields in other tables.

lefty 3/10/2019



I would look at the DAL function for inspiration. It will all you to pull data from fields in other tables.


Where do you want the grand total I assume at the bottom of the all the details records with the total of details plus a grand total ( totaling all the related detail fields and next to that ( Grand Total ) with the mileage field from your odometer calculation from master record - mileage****? Is that correct? Or do you want the grand total to show in the master record calculating all the detail records and insert into the master table - escort_mileage?
Also, I assume you have these setup as master table / detail relationship with the total in details correct? What are the relationship fields for each table?
This can be done easily in a report but if you need in the list pages , I need the above information.