Importing CSV data direct from a web URL
Here I'll walk through downloading a CSV file from HanDBase on the iPhone.
We first need to find the URL of the CSV file: launch HanDBase on the iPhone and open Desktop Connect. This starts the built-in web server and displays the URL to use in your browser: in this case it is http://192.168.1.119:8080 .There are example HanDBase database templates available on the downloads page. Use HanDBase's Desktop Connect feature to uploaded to the iPhone.
To make is as easy as possible to connect to the iPhone it is best if the IP address is always the same. To do this you must have access to your network and be able to configure static IP address assignments. On the Airport base stations this is possible using the Internet settings in Airport Utility: Select the DHCP tab and add a DHCP Reservation for you iPhone. The reservation needs the MAC address [format 00:xx:xx:xx:xx:xx] of the iPhone's network interface: this information is available via the iPhone Settings in the About screen's Wi-Fi Address field.
Now browse to the web
server using the URL and {ctrl}-click the C,S,V icon
of the Logbook X database. Choose 'Copy Link' to get
the URL of the CSV file: in this case it copies the
URL
"http://192.168.1.119:8080/export.csv?db=Asthma_Longbook_X.PDB"
OK, so we now have the
URL. Now we need to do something with it. Open up the
Mac Logbook and click 'Import' to display the Data
Import window. Then select the second Data Source:
If you haven't been
recording fields that have default values click the
relevant import checkboxes, and select whether to
import 'All events' or just those dated after the
last imported event. Now click 'Select file and
Inspect Data' to enter the URL where the download
file is located. Paste in the copied URL from the web
site then click 'OK':
The URL will be checked
for availability and the page's contents will be read
into the Logbook ready for processing: during this
time the progress indicator will display a 'barbers
pole' to show that it is working.
The import will now continue exactly as if a file had
been selected from the Mac's filesystem and the event
data will be extracted and displayed before asking
whether to complete the import or cancel it.
Keep time periods while importing
In version 1.1.5 an additional method has been added: import the data file's time periods, if they exist, and only calculate them if they do not. It option is not directly available from within the User Settings or Import window preferences, rather it is a 'hidden' option requiring a UNIX command to be run in Apple's Terminal.app.
To enable this new way of importing time period data open the Terminal.app type in the following command and then press the {return} key:
defaults write com.Nesfield.AsthmaLogbookX ImportTimePeriods YES
If you want to return to the normal way and ignore time periods during import and let the Logbook work them out, do the same as before but use this command:
defaults write com.Nesfield.AsthmaLogbookX ImportTimePeriods NO
This option is kept hidden as it is fairly important that the time period names are kept consistent and mis-typing them in handmade CSV files can cause additional periods to appear, such as:
Night may become NIGHT or night. That would be three time periods.
Having extra unwanted time periods would also impact the layout of the reports with them squashing the data into thin columns.

