To be clear, the error is mine, I know that much, I just cannot put my finger on it.
The story:
We have a semi-automated fuelpump, which gives us some basic data about usage.
From that, I get a list of vehicles, their owner, milage and how much fuel they took and when.
I made some forms for the end-users to display a list summarized by NR (vehicleNR) or owner etc.
One form, the 'Per vehicleNR', the list is in a Portal, where the fuelstops are sorted descending.
I use a script to modify table data as I cannot retain data, because of the way the fuelpump works, it’s all or nothing, so on each check,every so many days or weeks, I purge the database and read the lot in again by script. That import works fine, no issues there.
So far, so good…
I now need to calculate the average (AV consumption of each vehicule between 2 fuelstops.
Easy as pie in Excel, but I am stuck in Filemaker with this.
Below is the script.
The first record gets a ’0” in AV, that is fine.
The problem is, after that, I get ’?’ until the next NR is reached and then they all become ’X’.
I know about the ’X’, but I wonder where my mistake is that I get a ’?’ as result.
All fields are numbers except NR, which is Text (the licenseplate).
Go to Layout [ “ListTBPV” (TBPV) ]
View As [ View as Table ]
Sort Records [ Specified Sort Order: TBPV::NR; ascending ] [ Restore; No dialog ]
#
#
Go to Record/Request/Page [ First ]
Loop
#
Set Field [ TBPV::AV; If ( Get(RecordNumber) = 1;0; If ( TBPV::NR = GetNthRecord ( TBPV::NR; +1); TBPV::Quantity/((TBPV::KM-(GetNthRecord ( TBPV::KM; -1)))/100);"X")) ]
#
Go to Record/Request/Page [ Next; Exit after last ]
End Loop
The idea is: take the current records mileage, deduct the previous (except the first) which gives me the the number of KM driven since the last fuelstop. I alread y have the Quantity, so I divide Quantity by the result and by 100, to get the x L/100KM
Does anyone know where my blunder is?
Thanks!
Marc
[sub]If 'something' 'somewhere' gives 'some' error, expect random guesses or no replies at all.
Free Tip: The F1 Key does NOT destroy your PC![/sub]
The story:
We have a semi-automated fuelpump, which gives us some basic data about usage.
From that, I get a list of vehicles, their owner, milage and how much fuel they took and when.
I made some forms for the end-users to display a list summarized by NR (vehicleNR) or owner etc.
One form, the 'Per vehicleNR', the list is in a Portal, where the fuelstops are sorted descending.
I use a script to modify table data as I cannot retain data, because of the way the fuelpump works, it’s all or nothing, so on each check,every so many days or weeks, I purge the database and read the lot in again by script. That import works fine, no issues there.
So far, so good…
I now need to calculate the average (AV consumption of each vehicule between 2 fuelstops.
Easy as pie in Excel, but I am stuck in Filemaker with this.
Below is the script.
The first record gets a ’0” in AV, that is fine.
The problem is, after that, I get ’?’ until the next NR is reached and then they all become ’X’.
I know about the ’X’, but I wonder where my mistake is that I get a ’?’ as result.
All fields are numbers except NR, which is Text (the licenseplate).
Go to Layout [ “ListTBPV” (TBPV) ]
View As [ View as Table ]
Sort Records [ Specified Sort Order: TBPV::NR; ascending ] [ Restore; No dialog ]
#
#
Go to Record/Request/Page [ First ]
Loop
#
Set Field [ TBPV::AV; If ( Get(RecordNumber) = 1;0; If ( TBPV::NR = GetNthRecord ( TBPV::NR; +1); TBPV::Quantity/((TBPV::KM-(GetNthRecord ( TBPV::KM; -1)))/100);"X")) ]
#
Go to Record/Request/Page [ Next; Exit after last ]
End Loop
The idea is: take the current records mileage, deduct the previous (except the first) which gives me the the number of KM driven since the last fuelstop. I alread y have the Quantity, so I divide Quantity by the result and by 100, to get the x L/100KM
Does anyone know where my blunder is?
Thanks!
Marc
[sub]If 'something' 'somewhere' gives 'some' error, expect random guesses or no replies at all.
Free Tip: The F1 Key does NOT destroy your PC![/sub]