Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do you print file structure?

Posted on 1999-07-27
7
Medium Priority
?
276 Views
Last Modified: 2010-04-04
How do you print file structure in
Delphi 3?  I notice that the desktop
database utility doesn't have a print
file structure feature.

Anybody have any idea?????
0
Comment
Question by:waipahu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:Hamilton
ID: 1391440
Hi waipahi,

I don't really understand what you want to do. I guess you think of the standard variable type "file" you can assign an external file. What's the meaning of "print" in this relationship? What result do you aim to?

Regards,
Hamilton

0
 

Author Comment

by:waipahu
ID: 1391441
I want to print the file structure for documentation.

Or If i can cut and past the layout and bring it
into MS word.


0
 

Author Comment

by:waipahu
ID: 1391442
Need to print the file structure:
For instance: customer info layout

1. name     C 10
2. phone    C 7
3. address  C 35

etc etc..
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:Lischke
ID: 1391443
It seems you don't want to print a file's structure (as this wouldn't make any sense) but to print the content of a table, right?

If this is so then you have several opportunities. You could use QickReports or import the data to Excel.

Ciao, Mike
0
 

Author Comment

by:waipahu
ID: 1391444
Yes I do want to print the file structure. You know the layout description of
each field and the data type. This is needed for documentation. I don't
want to print the data in the file. I want to print the file structure.

0
 
LVL 10

Expert Comment

by:Lischke
ID: 1391445
Aha, now I understand what you want (and learned that my previous comment were wrong). It's a kind of extracting meta data from a database. Your description of extracting the structure of a file confused me as you really want to exctract the structure of a database/table, right?

Well, in this case I'd suggest to open the table in Delphi and use the Fields property. For each field you get its type and can convert it into a desctiptive string, along with its position in the table.

Does this help?

Ciao, Mike
0
 
LVL 2

Accepted Solution

by:
kjteng earned 40 total points
ID: 1391446
The following code shows a way to save the dbstructure to
an abc.txt file. Tested on d1 and d3.
Modify for youself if necessary:

procedure TForm1.Button1Click(Sender: TObject);
var ii: Longint; s: string; sl: TStringlist;
begin
  sl := TStringList.Create;
  with Table1.FieldDefs do
  for ii := 0 to Count -1 do begin
    s := IntToStr(Items[ii].FieldNo) +': ' + Items[ii].Name;
    case Items[ii].DataType of
      ftUnknown : s := s + ',' + 'Unknown';
      ftString  : s := s + ',' + 'String';
      ftSmallint: s := s + ',' + 'Smallint';
      ftInteger  : s := s + ',' + 'Integer';
      ftWord : s := s + ',' + 'Word';
      ftBoolean  : s := s + ',' + 'Boolean';
      ftFloat : s := s + ',' + 'Float';
      ftCurrency : s := s + ',' + 'Currency';
      ftBCD : s := s + ',' + 'BCD';
      ftDate : s := s + ',' + 'Date';
      ftTime : s := s + ',' + 'Time';
      ftDateTime : s := s + ',' + 'DateTime';
      ftBytes : s := s + ',' + 'Bytes';
      ftVarBytes : s := s + ',' + 'VarBytes';
      ftBlob : s := s + ',' + 'Blob';
      ftMemo : s := s + ',' + 'Memo';
      ftGraphic : s := s + ',' + 'Graphic';
      else s := s + ',' + 'Unknown';
    end;{case}
    s := s + ',' + IntToStr(Items[ii].Size);
    sl.Add(s);
    Showmessage(s);
  end; {for}
  sl.SaveToFile('e:\abc.txt');
  sl.Free;
end;

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question