Board index » off-topic » Paradox Database.....

Paradox Database.....


2004-05-04 11:37:21 PM
off-topic1
Where to start.....
1) I have a database that contains an order field which is a number
starting at zero... it is also the primary index for the database.
2) I need to be able to reorder the items in the list using this
number. But, I can see some possible stumbling blocks.
a) What do I do when I need to exchange two items. ie: when item #5
wants to move to item #4 and bump item #4 to #5. I imagine the same
holds true for the other way around as well. when #4 wants to become #5
and bumps #5 up to #4.
b) I need to preserve the order of the items in the database;
because they need to match a ListBox I'm filling with items from the
database.. When I move items around in the listbox, I use the index as
the order field for the database and keep track of the items that way.
Questions:
1) If I change the order number of one record and post the change then
can I use RecNo to get back to the other record or has all that changed?
I'm unsure on this?
2) Can you edit two records at the same time? Is this easy to do?
3) Anyone have a better solution?
Any help is greatly welcome,
James Kosin
 
 

Re:Paradox Database.....

James Kosin wrote:
Quote
Where to start.....

Ok, to update everyone.....
NO, you can not change the order field. Apparently, even though I did
not set it up as such, the field has to be UNIQUE. If I try to edit
this field requirement using Database Explorer, it claims that that
property is UNEDITABLE.
I tried MoveBy() thinking it might work... NOPE.
I had to take a brute force method of getting the information (field
data) from one record, then the second record and posting the first
record information into the second record, going back to the first
record and posting the data for the second record to the first.
Is there a structure or class that allows you to keep data from several
fields of a record so you can copy them to another record? I'd hate to
have to keep adding fields to my temporary pool just to copy 2 records
back and forth (minus the Order field of course).
Thanks,
James Kosin
 

Re:Paradox Database.....

James Kosin wrote:
Quote
James Kosin wrote:

>Where to start.....
>

Ok, to update everyone.....

Hopefully, LAST UPDATE....
To copy an arbitrary number of fields, use the Variant type. This
allows generic coping of fields in the database.
The code looks like this now....
{
Variant *Rec1;
/* this sets up the number of variants needed to hold the information */
Rec1 = new Variant[ DM_Holder->Arinc429_Table->Fields->Count ];
/* this actually copies the fields from the current record to the
temporary variant(s) */
for( i = 0; i < DM_Holder->Arinc429_Table->Fields->Count; i ++ )
if( i != DM_Holder->Arinc429_Table->Fields->IndexOf(
DM_Holder->Arinc429_Table->FieldByName( "Order" ) ) )
{
Rec1[ i ] = DM_Holder->Arinc429_Table->Fields->Fields[ i ]->Value;
}
}
NOTE: I really didn't need to skip the "Order" field when copying to the
variable. I only needed to skip it when I edit the records and swap them.
I also needed two records to hold the information; but, everyone can
see the point using this amount of code.
Thanks to myself,
James
 

{smallsort}