I have a file that my app grabs info from.
The file is newline delimited and has just 6 lines. however these are updated every second, so the same lines are continued thousands of times.
An excerpt.
Code: Select all
AVA001
EDDF
EDDB
fuel 19717.886719
240.741669
CRJ-900
AVA001
EDDF
EDDB
fuel 19716.490234
241.675003
CRJ-900
AVA001
EDDF
EDDB
fuel 19715.078125
242.658340
CRJ-900
AVA001
EDDF
EDDB
fuel 19713.728516
243.591660
CRJ-900
The fuel figure is the one i have issues with.
I'll explain the issue and perhaps the brains here could help me with my issue.
previously to get a total fuel used figure i did this.
Code: Select all
put char 1 to 10 of line 4 of url("file:" & tFullPath)into field "fuelstart"
put char 1 to 10 of line -3 of url("file:" & tFullPath)into field "fuelend"
-- calculate fuel used
set the numberformat to "0000.00"
put the round of field "fuelend" - field "fuelstart" into field "fuelused"
this grabs the first figure in fuel, subtracts the last giving me a total.
It works well this way.
However when deep testing it was pointed out to me that the user of the simulator is able to adjust the starting fuel figure, also if the aircraft is not started the fuel value is zero, which my app does not take into consideration.
so in the example text file above the fuel figure would start at 19717 (the figure my script grabs)
but the sim user could raise this figure (which would be captured in the text file at some point further down the list in the text file).
i included the word fuel in the new protocol so i could try and use a script that would identify the lines of text concerning fuel values.
Can anyone assist in what type of script could help?
I'm thinking of putting all the lines which include "fuel" into tfuledata
then getting the highest value in tfueldata into tfuelstart
tfuelstart into field fuelstart?
something like that,
Thanks
Alex