Subject | Re: [IBO] re [IBO} entering a new record. |
---|---|
Author | Geoff Worboys |
Post date | 2001-06-20T00:12:40Z |
Dave,
For simple SQL IBO will automatically generate the required
insert/edit/delete statements. It can simplify a lot if you can
arrange things to let IBO do this. IBO simply prepares the select -
to obtain all the relevant details, and then generates the required
statements. If you add fields to FieldsReadOnly property then these
are left out of the insert/edit statements - which can be very useful
for items that are set at the server.
EVEN IF you set the primary key at the server using a generator YOU
MUST still tell IBO about the generator and let IBO generate the
primary key - so that IBO has a valid identifier for the record,
allowing it to refresh the record from the server. To support this
your server trigger must be setup to accept predefined values, which
it seems yours is...
opening the dataset and retrieving any records. This may be useful to
you. For example...
Present the form in search mode, if the user needs to update a booking
they stick in the booking number and search to retrieve the required
record. Otherwise they hit a create button to start a new record -
IBO generates the insert for you, including generating the primary key
value. The user types the values and commits.
You can (and perhaps should) setup search mode so that they must
significantly restrict the selection by entering good search criteria.
Indeed you could setup so that only the booknum accepts search
criteria (and is set to PreventInsert and PreventEdit so the generated
value is not changed) and that a value must be input before the search
can proceed - preventing the user from trying to retrieve all records.
Alternatively you could use a TIB_DSQL with a parameterised insert
statement, and then manually tie non-IBO-aware controls to the
parameters. But this seems like a lot of work compared to the above.
Does this help?
Geoff Worboys
Telesis Computing
For simple SQL IBO will automatically generate the required
insert/edit/delete statements. It can simplify a lot if you can
arrange things to let IBO do this. IBO simply prepares the select -
to obtain all the relevant details, and then generates the required
statements. If you add fields to FieldsReadOnly property then these
are left out of the insert/edit statements - which can be very useful
for items that are set at the server.
EVEN IF you set the primary key at the server using a generator YOU
MUST still tell IBO about the generator and let IBO generate the
primary key - so that IBO has a valid identifier for the record,
allowing it to refresh the record from the server. To support this
your server trigger must be setup to accept predefined values, which
it seems yours is...
> if (bookings.booknum is null) bookings.booknum = gen_id(bkgen,1)IBO lets you go directly to Insert from Search mode - without actually
opening the dataset and retrieving any records. This may be useful to
you. For example...
Present the form in search mode, if the user needs to update a booking
they stick in the booking number and search to retrieve the required
record. Otherwise they hit a create button to start a new record -
IBO generates the insert for you, including generating the primary key
value. The user types the values and commits.
You can (and perhaps should) setup search mode so that they must
significantly restrict the selection by entering good search criteria.
Indeed you could setup so that only the booknum accepts search
criteria (and is set to PreventInsert and PreventEdit so the generated
value is not changed) and that a value must be input before the search
can proceed - preventing the user from trying to retrieve all records.
Alternatively you could use a TIB_DSQL with a parameterised insert
statement, and then manually tie non-IBO-aware controls to the
parameters. But this seems like a lot of work compared to the above.
> When I click on the datmodule form in the ProgramI have a DM_Contact.DFM in my source.
> Manager I get just the 'Unit DM_Contact' and no form.
Does this help?
Geoff Worboys
Telesis Computing