Link to home
Start Free TrialLog in
Avatar of roncm
roncm

asked on

EQUAVELENT OF xBASE AMPERSAND (&)

Using a table called DATADICT, it is possible in xBase languages to open a file without knowing the name of the file.  For example:

cFileName := DATADICT->FILENAME        {DATADICT-.FILENAME CONTAINING, SAY, "CUSTOMER.DBF"}
use &cFilename.                                       {Evaluates at runtime to:  CUSTOMER}

One responded pointed out that I could use a generic table component and simply put the filename from the data dictionary into the Table.Name property, yet I would prefer to use the table components in my data module.  In xBase syntax, I guess it would look something like this:  

var
  sTblName := string;

begin
  sTblName := datamod.tblDataDict['TABLNAME'];      {where this field contains 'tableCustomer'}
  datamod.&sTblName.Open;
end

Perhaps this is simply not possible in Object Pascal....:)

Avatar of Greedy
Greedy

I will try to pull myself back to the evil days of Clipper...Anyway depending on just what DATADICT->FILENAME is returning you would do this

I think DATADICT->FILENAME is the field filename in the table DataDict...right??? oh well that's what I will take it for

so do this

if Table1.Active then Table1.Active := False;
Table1.TableName := tbDataDict.FieldByName('FileName').AsString;
Table1.Active := True;

You will propbably also want to go into foxpro and type in this
delete all for database = sucky
pack  :)


Avatar of roncm

ASKER

Sorry, no help....
Avatar of roncm

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of jhunt
jhunt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of roncm

ASKER

Not possible.  I thought so.  Thanks jhunt...