Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create fields in a dynamic record at run time

Status
Not open for further replies.

john230873

Programmer
Oct 3, 2003
89
NZ
I have some code that I am writing to read data from Pervasive tables. The structure of the tables are always changing so I thought it would be good if I could read the field names at run time and create a record on the fly. Is it possible?

currently I have some code like this

STYLE_STRUCT = packed record
STYLE : Integer;
ITEM_SIZE : ARRAY[0..3] of char;
COLOUR : smallint;
STOCKP_NUMBER : Integer;
COLOUR_NUMBER : smallint;
BIN : ARRAY[0..3] of char;
PHOTO : ARRAY[0..0] of char;
LAST_SALE_DATE : integer; //date
LAST_REC_DATE : integer; //date
QTY_PURCHASED : Integer;
QTY_SOLD : Integer;
end;

but I would pefer if this struct could be changed during runtime so if the Style Table format changes then the program will change as well.

Something like what the TTable do with fields how you can add them at anytime.

I can't use a TTable as for pervasive you need DDF's and we don't have any.

 
I now thinking that each record is always going to be less the 1000 byte so I could have one field in the record of 1024 btyes and then use a pointer of some kind to get the parts of the field out I want.

Would this be on the right track?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top