SmallMap.com TabtoolLocal.htm
 
SmallMap Tool To Convert Tabbed Data To JavaScript Array

Version 050204. © 2005 SmallMap.com. All Rights Reserved. The use of this page is subject to your agreement with the SmallMap Software License Agreement. If this is a locally-saved copy, you can get the most updated and fully-formatted version of this tool here.


This tool helps you convert your data from a database/spreadsheet output into a JavaScript data format that is required by SmallMap program. This is an alternative to the spreadsheet "smallmap.xls." You need only either one of the tools.

Please see "Notes" below. For more instruction, see Manual Chapter 4. Customizing Your Mini Database 'SmallMap.js'. The two textareas below initially contain three sample lines. To process your actual data, clear the input textarea, then follow the two steps outlined.


Step 1: Input Tab-Separated Data Block
Input a block of data, which must be ASCII text and tab-delimited (data columns separated by the "tab" characters).      Select      Clear      Convert      Array index no. starts at
How do I obtain tab-delimited data block for the above input? Try copying a block of cells from your spreadsheet/database program and directly paste into the above. Navigate by arrow keys to check that the data columns are indeed separated by the tab characters. If this direct route doesn't work, try to "paste as text" into a text editor, before transplanting to the above. Alternatively, many spreadsheet and database programs allow you to save data in "tab-delimited" or "tab-separated" file format, using the "Save As" menu option. Then open that file, select all, and copy that block into the above.

Step 2: Copy Output to Paste into "smallmap.js"
Output is a text block in the format of a 2-dimensional JavaScript array. Copy and paste this into "smallmap.js" using a text editor. Replace sample data.      Select      Clear


Notes:

  • Blank lines and lines without any tab character will be ignored
  • All double quotes (") will be automatically converted to single quote (') to avoid confusion. Double quotes are used to indicate string type in JavaScript.
  • The name of the array is "un" (consider it "unit number").
  • In the output, this tool will add array name and index, such as "un[1]=..." in the JavaScript array style.
  • The initial declaration of the array is already contained within the SmallMap main program, and need not be done here
  • If you include the data column (field) names (such as "Customer Name", "Category", "Tel") here, remember to delete that line before pasting into the JavaScript file "smallmap.js", because this line will be given an index number and mistakenly read by the program as another record.
  • You can change the starting index number of the resulting array in Step 1, inside the text box following " Array index number starts at". This is in case you are converting your data in batches.
  • You can save this Web page on your local computer, and it should continue to work as a tool, even if part of the formatting is lost.
  • You can customize the script to change the requirement of delimitation by tab character to some other characters. You can do this by going into the convertThis() function, and changing the value of the variable "separator" from "\t" to something else. But double quote cannot be used as separator. Comma is a risky separator, because it often appears in addresses and other long text. Tab is still the safest.
  • Only for those interested in technical database details: Tabtool.htm may create shorter un[i] arrays if certain input rows contain fewer tab characters than other rows. These un[i] arrays will be shorter than those produced from smallmap.xls. But don't worry as these shorter un[i] arrays are compensated for within SmallMap index.htm scripts.


Two Sample Websites

Sample Town - A simplified and fictitious example, as well as a template containing the latest version of codes and scripts.

S2BJ - Sungai Dua and Bukit Jambul, a real-life commercial area in Penang, Malaysia.

Promotions

Free: First 10 registrations

Recent News

Apr 20, 2005 (Press Release)

 
Top of Page            Copyright © 2005 SmallMap.com All Rights Reserved