field data assignment on a record


2005-01-18 05:35:46 AM
delphi231
I have developed an application which reads Microsoft Project files
using OLE via the MS Project Type Library. In MS Project, data for a
task is stored in data segments. There are other segments which connect
to the task segment via links in the task data segment.
The task segment is made up of about 100 fields, with links
interspersed throughout. When you want to retrieve data from a
particular field, you request a data retrieval of the entire task
segment by using a task ID. That single retreival will contain all data
from all segments related to that task id. To extract a particular
field, you would assign the value for that field to a local variable,
such as
var task : Olevariant;
text1 :string;
ID : integer;
comboread :string;
begin
id := 70;
comboread := combobox1.items.selected; // what I want to
do
task := FMSProject.gettask(ID); // retrieve
all segments for a particular task ID
text1 := task.text1;
// typical way to retrieve data for a particular field
label1.caption := text1; //
show the result in a label
end;
In my application, I do not know which text field I will
need until runtime. Text field run from text1 through text30. The
source for a particular text field to be retrieved is a drop-down
combobox, which can be re-defined at runtime by the user to be a
different text field.
I want to be able to read the combobox to read the combobox
selected field and substitute it in the read function above; such as
text1 := task +'.'+comboread;
Thanks
Dan Roy