![]() | ![]() | ![]() | ![]() | ![]() |
Many programs and databases (Microsoft Excel or Access, Lotus 123 etc) allow you to export data in many different formats. The #import command allows you to import the most common formats and generate output to your specification.
The default output format for quite a few of the import types is a HTML table. Not only don't you need to generate a table at all, you also have a lot of fine tuning parameters if you wish to remain with a table but just wish to tweek its look (give certain columns a special background color etc). I have seen people generate a whole series of #define and #include commands to generate a separate html page for each record (from a product database).
This command might seem complicated at first (and in actual fact it is!), I recommend you actually try the examples (cut and paste as required).
If you are having problems working out what is going on I highly recommend the use of debugging (/debug or #debug) as this has been designed not just for debugging but for training as well. Note I recommend that if debugging you cut your database down to a few test records so that you won't be swamped with output.
All import types get handled in two distinct passes as follows:
If you have a filter then in some advanced applications you may need to use the WriteLineToTmpImportFile() routine. An example of this is if you wished to generate PPWIZARD commands such as #output.
If debug is not on then after pass two completes the temporary file is deleted. Turn debug on an examine the temporary file if things are not going to plan!
[WhiteSpace]#import ["]File2Import["] ["]T2H|WRAP["] ["]DefineName["] OR [WhiteSpace]#import ["]File2Import["] ["]ImportType[-]["] ["]DefineName["] ["]FieldInfo1["] ...
The parameters are as follows:
The exact #define options which are available will differ depending on the import type. If you specified a blank value for the prefix a default is used. The name of the default also varies with import type but for the common types is "IMPORT".
In some cases such as when HTML tables are generated there are multiple levels of defaults and changing a lower level one may have no effect if you also override a higher one. This is because the lower level values became the default values for the higher level. As an example there is no point specifying that record columns should have a background color of green and then overriding the record generation default! Again the use of debugging support will generally make this clear as it will show PPWIZARD looking for all options and display the value PPWIZARD has decided to use.
![]() | ![]() | ![]() | ![]() | ![]() |