Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Managing expenses with Palm and Notes (continued)

Note that there are a couple of lines at the top of the form reminding me to print it in Landscape; these have a hide-when to stop them from being printed along with the form.

Making a claim
On the Expenses view, the Make a Claim button calls an agent that then runs Lotuscript code in a script library. Unipart requires that each expense claim be made in only one currency, so the items to be claimed are selected from the view, and the agent is started. I have no validation code on this selection apart from checking that no more than twelve items have been selected. It's easier to use the Unmake claim action and try again than to check all the items are in the same currency before the agent processes them.

You can view the entire agent code at http://www.component-net.com/pp-extras/pp042001-expenses.html. Before you refer to the code, though, I'm going to call out some features of it.

The agent code
First, the subs CurrName and ClaimType turn the Palm code values into text strings. Sub CurrRate looks up exchange rate values, not to use in calculations, but merely to add to the form. You can see how those work. The guts of the code is in the sub MakeClaim. Here I've line-numbered the code to make it easier to refer to.

At line 6 we read the profile document and then create a new claim document. At line 9 we call sub ProfFields to add the static stuff from the profile to the claim form and to zero-ize the totals fields. You'll note in ProfFields, lines 8-13, we set some form fields to "4." Actually, the field on the form uses the Monotype Sorts font, so the character 4 prints as a check mark. Line 11 gets a handle on the selected items to be processed, and we then check how many there are. In line 18, we get a subject line for the claim form itself, and this is the only place where I type anything in the whole process of creating a claim.

From lines 20-55, there's a processing loop, one execution per input document. However, the lines on the form are not an array, so we use a bit of trickery illustrated in lines 23-25 to be able to treat these lines as an array. Remember that I said I'd let the designer name the fields on the claim form as I pasted them in? Well this is why: I was able to make the field names in each column of the form have a numeric suffix, for example, R1_Date_0 through R1_Rate_11.

Line 23 gives me a counter that counts up from zero. Line 24 gives me the string value of this, prefixed with an underscore: _0 through _11. Line 25 then uses the Execute Lotuscript function to, in effect, create the line of code on the fly with string concatenation and then execute it. So, as I go around the loop, the line of code at line 25 is re-created each time:

ClaimDoc.R1Date_0 = ExpDoc.Date(0)
ClaimDoc.R1Date_1 = ExpDoc.Date(0)

And so on. You can see this trick in several other places in the code.

Line 26 then puts the expense type (Taxi, Hotel, etc.) onto the claim and adds on the contents of the vendor field. Remember, I said I used this to enter details of the specific expense, such as where I parked my car or why I used a taxi.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Home > Reviews > Enterprise (7 articles)
   LinCo Services drives efficiencies with handheld route delivery application
   Super productivity: it's in the Palm of your hand
   Collaboration on small devices with Wiki
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
DominoPower: Application development, William Shatner, and the origin of the universe
OutlookPower: More about disappearing text
-- Advertisement --

Write for Computing Unplugged!
Share your experience and expertise with other handheld device users. There are new opportunities at ZATZ for contributing authors and editors.

Write about something you're an expert on and get your name in lights.

For Writers' Guidelines and to discuss topics, contact Staff Editor Steve Niles. This is your opportunity to shine in front of your peers, your clients, and friends.

Click for more info!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login