Lantica Software Support Center
Lantica Software Home Page


Use Mass Update For More Than Updating Records

From the Inside Sesame Help Desk

We've developed a PrintString routine that prints a perfect billing invoice from our multi-line invoice record. Because we're using a subform for the line items, the program includes separate subroutines to print the header, the footer and the body of the invoice. The routine that prints the body (the individual line items) does a loop through the subrecords. It all works great and we run the program from a command button labeled Print Invoice. My question is how can I print more than one invoice at a time. I'd like to print all of my monthly invoices for all of my customers without having to retrieve each record and click on Print Invoice. You guys always seem to have a way to do things. Can you help me?

We sure can. Sesame has a method for doing things to multiple records - all the records in the currently retrieved set. It is called Mass Update. This is nothing new to most Inside Sesame readers, but most people use it to update a value in multiple records such as setting a new price multiplier or changing a tax rate field. However, mass update can be used to run any type of programming from each record as long as that programming is in the Mass Update spec. So to do what you need, follow these steps.

1. Copy the programming from your Print Invoice command button to the clipboard. (In the program editor, Ctrl-A then Ctrl-C.

2. Preview your application and retrieve some records. Open the Mass Update Spec Window and select any LE from the form (not GLOBAL CODE). Paste the program in the clipboard into the editor window.

3. Click on the Mass Update Spec button and select Save. Assign a name to this saved Mass Update - let's call it Print Invoices. Now, close preview and go back to your design. Change your command button's On-Element-Entry program as follows. At the start of your main programming section add this:

Var vInvoice as string
Var vRun as Int		

//Offer User Choice of Invoices Popup is over Print button
PopupSelectPosition(4, @XPos(Print Invoice)-25, @YPos(Print Invoice))
vInvoice = @PopupMenu("This Record Only;All Retrieved Records", "Which Invoice(s) would you like to print?")

If vInvoice = "This Record Only"
 	//Place your current printing routine here

// This is what you add that will run the Saved Mass Update on
// All of the retrieved records and print them

Else If vInvoice = "All Retrieved Records"
	If @Mode() = 1
		vRun = @LoadMassUpdateSpec("Print Invoices")
		If vRun = 1

There you have it. You can use Mass Update not only to update records but to cycle through them and run whatever programming you wish. In this case, ask the user and print multiple records.

This approach can be used to do other things such as special postings, program testing, data testing, selective exporting, and so forth. The thing to remember is that any programming you want Mass Update to run must be included in the Mass Update spec. A Mass Update will not run regular application programming unless you duplicate it here. You also need to remember to set the Reconcile option to replace saved specs in the target application if you've created your Mass Update spec in Designer's Preview mode.

Think of Mass Update as another tool you can use to make your applications sing.