Runtime Revolution
 
Articles Other News

Quick Apps with Revolution: The Mileage Calculator


by Jim Carwardine


Jim Carwardine is a business coach and mentor specializing in - StrategicDoing(TM) - the act of linking the Strategic Plans of the business to what each employee DOES every day...

I used Rev for this project because I could write my code as I thought it out. Because of its English-like syntax, I could kind of think in code as I self-talked my through the how-the-heck-will-I-do-this part. At the end of the day, I had a working prototype that did exactly what I wanted it to do... Not elegant, but did the job...

I wanted to do an analysis of my vehicle use for my business. I was doing a kind of historical looking back, opportunity cost analysis. I didn't have enough of my driving logs from former years to do an adequate job so I had to find a creative way to approximate the mileage.

In my business I meet my clients one on one and I also meet them in groups in regularly scheduled meetings every week, biweekly and monthly. These meeting cycles will last anywhere from 18 months to 6 years.

What I decided to do was base my whereabouts on a daily basis by the receipts I had collected plus my regularly scheduled meetings. I had all my receipts for the 6 years I wanted to recreate. I usually bought something every where I went - lunch, gas, an errand, etc.

I designed a chronologically-based algorithm that collected the things I did each day and linked them in a round trip that started each morning at my office and ended each day at my office. I built up a point-to-point mileage table by having my stack interact with me using an ANSWER dialogue when it found a destination that wasn't in the list and asking me if want to record it in the mileage table. If I said yes, it recorded it and I would go into the table manually and update the one way mileage. Google Maps and Mapquest were good sources of mileage stats.

I had to take care of weekend mileage, which generally was personal miles but needed to be added in so the mileage counter was accurate for the start of the next week. I used a random number from 1 to 40 to simulate that weekend mileage and it turned out to be pretty accurate. I also needed to simulate driving from point to point in the same city, where I didn't take the time to calculate the mileage address to address, just city to city. In the city I do most of my business in, you can get almost anywhere in 15 minutes. So, I used a random number from 1 to 15 to simulate that. Worked fine.

Now, I have a mileage report generator that gives a detailed mileage point to point and a summary mileage for each day that will handle any period of time, any number of meetings in a day and simulate the mileage driven.

I'd like to now switch it over to use the calendar from Entourage, parsing out the business trips instead of using my receipts and I'd also like to use Mapquest automatically for point to point mileage to make it even more accurate.

Rev makes it almost fun... Jim Carwardine

You can download the finished Mileage Calculator app here.

 
©2005 Runtime Revolution Ltd, 15-19 York Place, Edinburgh, Scotland, UK, EH1 3EB.
Questions? Email info@runrev.com for answers.