Subject Re: [IBO] Philosophy of using IBObjects
Author Helen Borrie
At 06:22 PM 09-07-01 +0000, you wrote:
>Sorry for maybe trivial questions (and my english)
>Problem is:
>I'am translating my programs to IB from DBF. If someone can help to
>solve few basic problems I'll be very ....
>I start to try TIBTable first.

You do mean TIBOTable, right?

>1. how can I add record to dataset, post it and keep that record
>active (to make some other operations - like print form etc.)

The first thing to do is get your KeyLinks right. It needs to be one line for each column of the primary key.

>2. what can I do to keep position in dataset when other users are
>adding new data -

If other users are adding new data you won't see them until your own work is committed and you refresh your table.

>I want to see it but stay at previous position in
>grid. I try it with triggers

Triggers work on the server, not in your client app. There is no physical ordering of rows on the server such as you have been used to in dBase. New rows are placed anywhere in the database file where there is space - on a new page, if necessary.

> but not everytime bookmark created
>automatically by IBO is valid - then I can't keep positioning on same

If your KeyLinks are correct, the bookmarks will be correct. IBO uses the KeyLinks to create the bookmarks. It also uses them for the repositioning of the cursor after the refresh. The default behaviour of Insert is to position the cursor at the same row it was on before the dataset entered Insert mode and to show the new row before it.

Are you using Insert or Append?

>3. I have to write to database positions of one document ex. orders
>with one unique symbol and number and different positions with it.

Can you explain this more? I don't understand this description.

>How to make it (special generator procedure or lock table for this
>moment) ?

In InterBase you don't lock tables (except in very rare conditions). One user's work is isolated from others by the isolation level of the transaction. In the TIBO scenario, the default isolation level is tiConcurrency.

A generator can be used to ensure you get a unique number to use as a primary key value. Is your primary key an integer type ? Have you defined a generator for it? Do you have a Before Insert trigger for it?

If you do have this structure in place, you can use the GeneratorLinks property to bring the new generator value across to new inserts automatically. You don't need locks to insert a row with a generator primary key. It is guaranteed to be unique and this uniqueness is not affected by other users.

>4. When I try to use KeyLinks to position in dataset I often have not
>valid record identyfication for change data - when KeyLinks is auto
>created this problem is not present.

IF your table has a primary key, then let the KeyLinks be autocreated.... If it doesn't, you must set up KeyLinks to be the column or group of columns that identifies a row of your table uniquely.

Please confirm that you are >>not<< trying to use TIBTable with IBO. (This component belongs to IBX and cannot be mixed with IBO components). You need TIBODatabase and TIBOTable or TIBOQuery. Use the VCL controls and use TDatasource to link the TIBO objects to them.


All for Open and Open for All
InterBase Developer Initiative ยท