Downloading orders

CSV File

Orders are downloaded from the web server in CSV format. The file in unnormalised form: the orders and orderDetails tables are joined together, and the product name is also included. This is a fairly standard format for downloading data from a web server. Orders for more than one item are split over several lines, with line for each item. Only fresh orders are downloaded.

Change Flags

In order to avoid downloading the samer record more than once, change flags is used. Every record has a flag that indicates whether it has been downloaded (or processed in some other way). The flag is set when the record is uploaded from a mobile device and reset when the Clear change flags option is selected. The standard procedure is:

  1. download orders
  2. process CSV file
  3. reset change flags

Repeat Uploads

The system allows users to upload an order more than once. This usually happens when the first attempt fails for some reason, or when the data has not been uploaded correctly. The hosting service also allows orders to be uploaded more than once, and updated records are output in the CSV file together with fresh ones. This means that the same order can be downloaded more than once.

Duplicate Order Ids

The mobile app allocates order numbers in sequence, and in a multi-user environment each user is allocated a separate reange of order ids. In principle this should ensure that order ids are always unique. However it is always possible that two users will use the same order id by mistake.

The hosting service can handle this, and both orders will be output to the CSV file. But the system that you are importing the CSV files to probably expects unique order ids. To help resolve this, the Find duplicates option lists all orders with duplicate ids. Hopefully there will not be any.

Author: Philip Sheard

Philip Sheard has been working in IT for over 40 years, and on this project for the last 20. His current skills include Java, Android, Objective-C, iOS, PHP, MySQL, ASP.Net, SQL Server, HTML, CSS, Apache and WordPress.