DroidDB Tip of the Month
DroidDB® Tip for September 2012
Using a Value From the Current Record When Creating a New Record
When creating a new record, you might want to initialize a control to the value in the current record. How to do this depends on your form and what you are trying to do:
Option 1:
If you have a filter active and the filter has just a single condition like ORDER_NUMBER = 1234, DroidDB automatically fills in the ORDER_NUMBER with 1234 when a new record is created.
This is especially useful if you launched the form using a Jump Button. If you jumped based on ORDER_NUMBER and the Jump Button's properties has "Only show matches" checked, DroidDB automatically activates a filter with the condition ORDER_NUMBER = 1234.
Option 2:
If Option 1 doesn't work for you, you can duplicate values using a macro. Say you have a form with an DESCRIPTION and a DATE. When you create a new record, you want to the DESCRIPTION to default to the one in the current record, but you want the DATE to be NULL (and DATE's default value is NULL as defined in the control). If you only need to duplicate a few values, this macro will work:
Step 1: ASSIGN, Value = DESCRIPTION, Col = @var(0)
Step 2: RECORD | INSERT
Step 3: ASSIGN, Value = @var(0), Col = DESCRIPTION
If you find you need to duplicate many values, this macro will work:
Step 1: RECORD | DUPLICATE
Step 2: ASSIGN, Value = '', Col = DATE