Home    Cart    Free Download    Manual

Installation:
  Free Downloads
  The H2O Family
  Install Notes

Programming:
  Prerequisites
  H2O Whitepaper
  Online Manual
  Code Examples
  H2O Free Support


What's H2O?
H2O is programming made for the web.

What's it like?
H2O is English-like. If you know some Perl, VB, ASP, or PhP you'll be immediately productive in H2O. It runs on Linux, Mac, Unix, and Windows.

How do I try it?
Download H2O for free. Get it from hosting providers. Or buy on-line.

Where does H2O come from?
The language was invented by Aestiva. H2O stands for:
   HTML with
   HTML/OS
   Overlays.


Display CSV File

All programmers, now and then, need to read data from text-delimited files; those text files where columns of data are organized in rows with each column separated from the next with a character such as a tab, or a comma. Take any speadsheet and export it as a CSV file and you'll see what they look like.

Luckily, H2O makes the handling of such files easy. This is because H2O variables are 2-dimentional. You do not need to allocate memory or define special variables. Plus, H2O commands "understand" text-delimited files. They are also know as Open Text Format (further information on this topic is available in the HTML/OS Knowledge Base) so commands readily read and write these kinds of files.

The Open Text engine built into H2O hnadles the "escape" characters, quoting, and column separation. You do not have to worry about the content of the columns and whether it conflicts with the file structure. All you need to know is the name of the file you want to read or write and that it's comma-separated.

The code below offers a fine example. At the top of this code a COPY tag is used to load data. Note that only a single COPY tag is needed. Then a single DISPLAY tag is used to display the data in the file. So, the first tag reads the data into a variable. The second displays it. Note that the DISPLAY tag with a "NAME=variable" parameter automatically displays the lines of the array csv_data as specified by the format that follows it. This version of the DISPLAY tag is particularly handy.

Also note the use of the special cate(^) quoting character. If you are new to H2O this may appear odd. FYI, in H2O you can use single-quotes, double-quotes, or the caret (^) as quotes. The caret is quite convenient when the content of your text is Javascript containing single and double quotes. Feel free to use any of H2O's three quoting characters to quote "literals."

csv_view.html




<<
# load csv file /#
COPY FILE="csv_data.txt" TS="," TO csv_data /COPY
>>

<html>
<title>Display CSV File/Report</title>
<body bgcolor=white>

<font size=4 color=darkblue>CSV File Viewer</font><br>

<table border=1 cellpadding=10>
<tr><td>Name</td><td>Phone</td>
<td>Company</td><td>Email</td></tr>


<<DISPLAY NAME=csv_data
^<tr><td>[1]</td><td>[2]</td><td>[3]</td><td>
<A href=mailto:"[4]">[4]</a></td></tr>^
/DISPLAY

>>


</table>

</body>
</html>

Home | Cart | Free Download | Online Manual
COPYRIGHT © 2005 Aestiva, LLC. ALL RIGHTS RESERVED.