Reading a value from an existing cell
Do a calculation on it and enter the value in the table..
And so on..
What I'm trying to do is a fuel consumption calculator.
What I do today, every time I fuel the motorcycle, i take a picture with my cell phone of my mileage, and the amount of fuel I fueled and how much it cost.
Then when I get home I put the data into Excel and there it's easy to calculate.
In the first cell I write the date.
The new mileage value minus the previous one, that's the range I've driven.
This is the second cell.
In the third cell I write the value of the second cell (the range I traveled) divided by the amount of fuel, this is the average consumption.
In the fourth cell the quantity in liters, and in the fifth the cost.
What I've been able to do so far (on my first day in the apps)
It's just to write the data to a CSV file and display it.
But I couldn't figure out how I take them and do calculations on them to insert a new value with them.
Any chance of help? Or give me direction?
Maybe I should do it in Google Sheets and not in CSV?
Attached File
Thanks to everyone who can and is willing to help!! Delek.aia (4.6 KB)
Can I suggest a change of direction? Why not enter the relevant values directly into the App (into TextBoxes), at the fuel pump? The would eradicate the need for a spread sheet or CSV file.
you may suggest anything!
"Why not enter the relevant values directly into the App (into TextBoxes), at the fuel pump?"
this is exsectly what i'm doing! (doing now with the app, until the app i was taking a photos of the data and then insert the values to the excel file)
the only issue is that i dont want to activate and reset the "trip meter" every time i'm fueling.
i want to enter the total km i did until i'm visiting the pump. (and then by reducing the last call from the km clock, i'll know how many km i did since the last time i fuled.)
(if i understand correctrly u'r suggestment, u say: "enter the 2 values of km.. the current kn and the privious one, and the app will do it with easely., the problem here is 2 things
i will need to enter more data..
i will need to look somewhere what was my km call at the last time i viseted the pump, so i will need to search it in the app. (the only thing i want is the app to know what was the last km reading.. and use this value.
Hope I'm understandable and not too spoiled
After all, why make apps if not to save time on the little things.
do you have a suggestment about how the app will know the last km value ?
(From there it's an easy way to get what I'm looking for)
Thanks!!!!
after reading your suggestment for the third time.. maybe this is the relevent answer (And if the question was why in the first place keep the fueling history, the reason is that with such monitoring, if you see a decrease/increase in the average fuel consumption, this could indicate a problem with the motorcycle, perhaps poor air pressure or a problem with the engine. That's why I prefer to follow this as well. (And even when I want to sell the motorcycle, gathering such information points to a responsible person and will give more confidence to the future buyer))
that's looks like a good diraction. thanks!
coz i saw you were dealing with csv issue, do u know how can i open the csv file ?
coz i cant find the acctual file on my phone storage to edit it manualy.
can i put a button to open it ? (is there an option to do so?)
Thanks, i will look into it.
I'm still not the most knowledgeable about scripts, I need to understand how they integrate within the application, this seems to me a long way to a more efficient solution, I'm currently trying quick and dirt_y
But thanks a lot for the direction, it will definitely help me learn how to do it better.
The truth is that I thought that I just needed to add a few more blocks (of which I have no idea) and there I am
I did not imagine that the road is still so long until the solution.
You don't need to create or store a CSV file, just store the values in TinyDb. The values can be comma separated in TinyDb, or the App can do that after fetching them from TinyDb, if you wish to present the info in a Table.
The advantage of my proposal is that the data is always at hand, when you need it. If you start storing things in the cloud (Google Sheets) , you can only get your data if you have an internet connection.
Ok. i have made some steps.
i guess i'm on the right way,
but now i need to understand , when the screen1.initialized,
how can i get the last value from the km
and then, make some math to get the trip,
and from there 1 more math to get the km/L