![]() |
FoxPop |
www.foxpop.co.uk |
POWERBASE TUTORIAL 5a
by Laurie Jane Kern
IMPORTING AND EXPORTING DATA FILES
Before starting, may I take the opportunity to say how much I am enjoying the email I'm receiving from people who are following these tutorials all around the world.
I am breaking lesson 5 into two smaller sections. I hope this will make for more manageable units, as the Web page can become quite sizeable when the illustrative screenshots are added! This tutorial, 5a, will explore exporting to a DATA file and importing a DATA file to a new Table. tutorial 5b will cover exporting to a TEXT file and merging into an existing Table.
Firstly make sure you have the database from the last lesson or download it now. SampleAdBook(03) Start by opening the Contacts Table in the List View. You have 6 names in the Table; you may have more if you added your own name to the database, as suggested at the end of the last tutorial.
Exporting
Make sure you have the focus on the Contacts table within the List View. Now go to the menu and File|More|Export Group... (As shown in this screen shot).
You are exporting a Group - you will learn Groups soon - they can be used to select contacts that meet simple or complex criteria. A Group that is applied to a View can then be used to select which contacts to export. At the moment you have a default Group named "All records": this is the Group that will be exported.
You will then be presented with the "Export dialog box" as shown below - it shows that you are exporting from the Contacts table.
On the File tab, select the default file type of DATA, name the file TEST1 and create it in the Documents folder. The Text Options tab is disabled because that is for exporting to a Text file. Now click the OK button. You will now see the export window (seen here)
Does this screen look familiar? It should, it is very similar to the screen for building a table; but in case you do not recognise it, let's review it. On the left half of the screen is a list of all the Fields in the Table that you are exporting from. On the right is a list of Fields in the View you are using. You will be concentrating on Views in a few weeks' time, but for the moment it is enough to recognise that if you have a View with only First Name and Phone number, those will be the only 2 Fields you will see on the right-hand side of the screen. If there is a Field in the Table which you want to export, but it is not displayed in the current view, you can drag it from the left to the right. Conversely if you DO NOT want to export a field, lets say TITLE, you can drag it from the right and drop it on the left and it will not be exported. Try that out for yourself now with this export - remove the Field TITLE, and while you are at it, also remove the FAX Field. Now change things even more! Click and drag the LAST NAME Field and position it above the FIRST NAME Field. Now drag TELEPHONE HOME and position it below TELEPHONE WORK. This demonstrates the flexibility you have - you can change the order in which the Fields are exported while working in this screen mode.
The next screen shot shows all of this reordering. When you are ready click the "Export" button in the upper left corner. When PowerBase has finished exporting you will be taken back to the main window and the program will flash "Completed" in the upper right corner.
Now move to the Documents directory on your Geofox or Psion and you should find a DATA file of about 6K in size there named TEST1. Open it up and you should have something like the screen shot below. Congratulations! You have successfully exported to a DATA file! Notice the changes which you made are in place, Last Name is above First Name and there is no FAX number.
Importing into a new Table
So, now you have a DATA file that you can use as a sample to import to a new Table in our PowerBase Sample Address Book.
Go to the menu and select File|More|Import new table... (as shown in the screen shot) .
You are then shown the "Create new Table from file" dialog box. Enter the new Table name as MYTEST1, from a file of type DATA (the other option is a text file). Then locate the DATA file, TEST1 - navigate to its location in the Documents Folder (as shown in the next screen shot) and then click OK
PowerBase then takes you to the "Import" screen, which I hope will look familiar by now! PowerBase has listed the Fields it found in the DATA file on the left side of the window and it shows the Field types using the same icons you saw when you displayed the Fields section in the Schema (Tutorial 3). On the right side of the import window are all the Field names you are going to import; all Fields are selected for import by default. But what if you don't want to import all the Fields? Well, you can do as you did when exporting, simply drag a Field from the right side and drop it on the left.
Look at the screenshot below and see the Fields I have selected for import, having dragged the ones I don't want over to the left-hand side. I am only going to import 7 Fields. I have also scrolled my left-hand window down to the bottom of the Fields list so it shows the Notes Field as a field type of MEMO and the ID Field as a number.
When you are ready click the "Import" button and when it is done you will get a quick message saying the import is completed. Now when you look at the Schema you will find your new Table. In the screen shot below I have the Schema showing the original Contacts Table we designed in Tutorial 2, and built in tutorial 3, together with the new Table called MYTEST1 which you have just created.
Using the Schema, examine the Fields in the new Table MYTEST1. You will see the 7 Fields you have just imported. If you open the Card View for the Table, you will see that it shows record 1 of 6.
Using the Schema again, double click on the Field Email1 in the MYTEST1 Table and display the properties dialog box. You will see that it has a length of 30. Then if you move to your original Contacts Table and click on the same Field, you will find the same field length. If you open up the sample DATA file, TEST1 and look at the properties of the Email1 Field, you will see that it too has a field length of 30. When you export to a DATA file, the Field type and length is preserved, and the same is true when you import from a DATA file.
Conclusion
Before we close, let me give you some words of advice on problems you can encounter with Fields when performing an export or import. The tutorials have not covered all these topics yet, and there are more issues that are covered in the PDF manual (which comes when you purchase the full application). These issues will make more sense when you get further into the tutorial series, but it is perhaps wise to mention them at this point.
![]() | Calculated fields are exported as the result of the expression, rather than the underlying calculation |
![]() | A Memo Field in PowerBase is exported to a DATA file as a Memo Field. A Memo Field in PowerBase is truncated to 255 characters when exporting to a Text file. |
![]() | Date and Time Fields are exported independent of the display format, so they can be easily read by other desktop applications. Import of Date/Time Fields can be done, provided it is a format recognised by PowerBase. |
![]() | DATA files support embedded objects within Text or Memo Field and PowerBase has a separate Text, Memo and Object Field. Thus you can export a field of type Object, to a DATA file but importing objects from a Text field in a DATA file is not supported. Also importing and exporting of embedded objects using Text files is not supported. |
I have shown you here how to import into a new Table using a DATA file, but you are not limited to that file format, it is also possible to use a Text file. As explained above, and also in the PDF manual, there are advantages and disadvantages attached to using each file type. To recap, you can export to either a Text or DATA file, you can also use either of these file types for an import to a new Table AND you can use either of these file types for a merge into an existing Table.
In our next tutorial I will show you how to export to a Text file and how to use a Text file for merging into an existing Table.
Download the sample Address Book (04) which brings you up to date with the end of tutorial 5a
I hope to see you all next time!
© LJKern and FoxPop 1999