The GeekZone

DroidDB® Macros and Events

DroidDB has a Macro Programming capability. A Macro Program is defined as a sequence of commands that are executed, one at a time. Macro Programs are invoked when (a) the user clicks a button on the form, or (b) an event occurs (such as a value changed or a control gets or loses focus).

Each command step in a macro can do one of many things:

Menu Command
Performs a menu command from within a macro program. Any menu command can be handled this way.

Run Form
Launches another DroidDB form.

Run External
Some other application.

Report
Generates a report about the current record or all records.

Jump
Launches another DroidDB form and positions to a related record in that form.

Message/Beep/Sound
Puts up a message box on the screen with a message you specify, plays a system sound, or plays a pre-recorded sound.

Assign
Assigns a value to a column or global variable. The value can be an expression (the same type of expression that you specify in a calculated control).

Skip
Skips forwards or backwards in the Macro Program. You specify a specific place in the macro to go to. Alternatively, you specify the number of commands you want to skip (positive values skip forward, negative values skip backwards) as an expression (the same type of expression that you specify in a calculated control). An if...then...else can be used to control where to skip to (the condition can depend on the current values in the record).

Filter
Turn record filters on or off.

Barcode
Reads a barcode into a column of the table or a global variable.

GPS
Reads a NMEA GPS signal into a column of the table or a global variable.

mEnable
Synchronize the handheld over a wireless network.

Import/Export
Import/Export of text files.

Sleep
Delays the execution of a Macro Program for a specified number of seconds.

Change sort/search order
Changes the order of the records in the table.

Run a sub-macro
Run another macro and then continue with this one.

Set Timer
Sets a timer to run a macro at a later date/time.

SMS
Sends an SMS text message or opens a form when an SMS test message is received.

Show/Hide control
Show or hide a control.

Set focus
Set focus on a control.

Dial
Dial a phone.

Select Tab
Control the tab that is selected.

Things you can do with Macro Programming:

  • If you are building a questionnaire, you can have a button that sets a checkmark (for example, gender) and then moves to the next appropriate set of questions.

Assign “Male” to Gender

Move to tab with “Male” questions

Return from macro

  • You can add integrity constraints: test to make sure a value is in range and if not, display an error:

Skip button: if age >= 0 go to Continue

Put up an error message

Return from macro

Continue:

Save the record

Return from macro

  • You can add an event to a dropdown that gets triggered when the value in the dropdown changes. If you have a "Gender" dropdown, this could be used to hide/show a "Pregnant?" checkbox:

Skip button: if Gender = 'Male' then 2 else 0

Show "Pregnant?" checkbox

Return from macro

Hide "Pregnant?" checkbox

Return from macro

Bear in mind that this is a macro capability that is running on a handheld device. If you need to do significant record processing, it would be better to do this using some other tool on the desktop.

Events

Events are generally (but not always) actions initiated by the user. You can associate a macro with an event, so that when the event occurs, the macro runs automatically.

DroidDB supports the following events:

Focus
A control gets/loses input focus.

Changed
The value in a control was changed by the user.

Record Display
The form is moved to a record.

Leave Record
The form is moved from a record.

Startup
The form is starting.

Select Tab
The selected tab has changed.

Visit our store

Top rated! I needed a solid database application development tool for mobile devices. I chose DroidDB for Android OS because it provided a way to get a strong product to market quickly. DroidDB is relational, gives me control over form layout, handles macros, and supports events. It works on all Android versions I have tried and is a great companion product to SYWARE’s VisualCE.

Mark Read, President
SyntegraTech, Inc.

signup for our newsletter