Functions for Databases

"It's still web development, it's just way easier!"

Database

Type Description/Example/Result
each Loops through an entire database table while defining its fields for each entry. Defines <#each> (keys) and <#eachcount> (entry increment), <#truecount> (increments during each that was True). Can also use with the test (see Lists reference) function to generate dynamic results. For each key if test is present and True then this value is returned.

<#ForSale:each="<#eachcount>/<#truecount>. <#each>, <#Price>"> 1/1. 123, 19.95
2/2. 124, 24.95
eachfalse Use with test (see Lists reference) function to generate dynamic results. For each key if test is False then this value is returned.

<#ForSale:test="<#eachcount> == 2",eachfalse="<#eachcount>. <#each>, <#Price>"> 1. 123, 19.95
headers Returns a comma-separated list of the headers of a database.

<#ForSale:headers> Key,Description,Price
Works on child database tables.

<#MyDB|123|Col5:headers> Key,Child
headers="" Rearrange and or omit headers to revise a table.

<#ForSale:headers="Description,Price",table>
Description Price
Short sleave shirt 19.95
Long sleave shirt 24.95
headers="" Each header can be assigned another value the populate or replace an existing value for the entire column it represents. The entire header task value may also be a Wrival Insert, but it must start as so.

<#ForSale:headers="Description='Replace value! Was: <#Description>',Price",table>
Description Price
Replace value! Was: Short sleave shirt 19.95
Replace value! Was: Long sleave shirt 24.95
headermaxes Returns a comma-separated list of the headers and their maximum lengths.

<#ForSale:headermaxes> Key=,Description=,Price=
headeroptions Returns a comma-separated list of the headers and their types from a database.

<#ForSale:headeroptions> Key=,Description=,Price=
headertypes Returns a comma-separated list of the headers and their types from a database.

<#ForSale:headertypes> Key=key,Description=variable,Price=variable
indexes Returns the amount of entries of the database table.

<#ForSale:indexes> 2
invert Invert the order of the line sequence.

<#ForSale:invert,table>
Key Description Price
124 Long sleave shirt 24.95
123 Short sleave shirt 19.95
keys Returns a comma-separated list of the keys in a database (see also unique).

<#ForSale:keys> 123,124
Works on child database tables.

<#MyDB|123|Col5:keys> A,B
matchrating Return only entries that match the provided keywords and sort the results by match rating. No keywords returns all and there's a minimum of 2 characters required per keyword to be including in the match evaluation.

<#ForSale:matchrating="shirt 24",table>
Key Description Price
124 Long sleave shirt 24.95
123 Short sleave shirt 19.95
merge Combine two (or more) database tables.

<#ForSale:merge="ForSale2",table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
124 Long sleave shirt 24.95
123 Short sleave shirt 19.95
125 Sweater 39.95
nonetrue Return if no tests were True.

<#"1,2,3":test="124 == 4",nonetrue="None True",each="124"> None True
notr Don't write the header row when building a table.

<#ForSale:table,notr>
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
place Returns the placement of a list item or key. Returns 0 if not present.

<#ForSale:place="124"> 2
random Return one random key.

<#ForSale:random> 123
randomize Return the keys in a random sequence.

<#ForSale:randomize> 123,124
renameheader Change a header name.

<#ForSale:renameheader="Price,Amount",table>
Key Description Amount
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
sort Sort by line (case sensitive).

<#ForSale:sort,table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
sort="" Sort by specific columns as desired.

<#ForSale:sort="Description,Price",table>
Key Description Price
124 Long sleave shirt 24.95
123 Short sleave shirt 19.95
sortcase Sort by line (case sensitive).

<#ForSale:sortcase,table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
sortnum Sort by key's numerical value.

<#ForSale:sortnum,table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
sortnum="" Sort by a specific column's numerical value.

<#ForSale:sortnum="Price",table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
sublist Returns a list of the keys that were evaluated as True.

<#ForSale:sublist="Price > 20"> 124
subtable Returns a table of the entries that were evaluated as True.

<#ForSale:subtable="Price > 20",table>
Key Description Price
124 Long sleave shirt 24.95
table Converts a database (or any tabbed text file) to an HTML table. The first line is converted to headers in <th> tags and the rest of the lines into <td> tags. Defines name as the current Key and value as the entrycount.

<#ForSale:table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
Additional infomartion passed is inserted as an attributes in the HTML <table> tag.

<#ForSale:table='id="chart"'>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
Will work on child database tables or any tabbed text file.

<#MyDB|123|Col5:table='width="100%"'>
Key Child
A A Value.
B B Value.
tableheaders Which headers to show in a table. It allows for use of data within a table, but not necessarily show them.

<#ForSale:tableheaders="Key,Description",table>
Key Description
123 Short sleave shirt
124 Long sleave shirt
tdonly Generate and return only the entry rows. This allows for a custom table tag or for multiple rows builds to go into one table.

<#ForSale:tdonly;table>
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
test Only returns entries that pass the test.

<#ForSale:test="<#Price == 24.95>",table>
Key Description Price
124 Long sleave shirt 24.95
tr Use its value within every opening <TR> tag (after the first).

<#ForSale:tr='style="background-color: yellow;"',table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
tr1 Use its value within the first header row.

<#ForSale:tr1='style="text-decoration: underline;"',table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
tr1html Custom header row.

<#ForSale:tr1html='<tr><th colspan="3">My HTML</th></tr>',table>
My HTML
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
tr2html Custom footer row.

<#ForSale:tr2html='<tr><th colspan="3">My HTML</th></tr>',table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
My HTML
rewrite Rewrite cells. Works only during building a table unlike headers="", which is applied imediately and directly inline.

<#ForSale:rewrite="Key='<#truecount>.',Price='$<#Price:round>'",table>
Key Description Price
1. Short sleave shirt $20
2. Long sleave shirt $25
trueafter Content to return after the results if any each, table, or loop's test was True.

<#ForSale:trueafter="After Content",test="Price > 20",table>
Key Description Price
124 Long sleave shirt 24.95
After Content
truebefore Content to return before the results if any each, table, or loop's test was True.

<#ForSale:truebefore="Before Content",test="Price > 20",table> Before Content
Key Description Price
124 Long sleave shirt 24.95
unique Remove any lines that have the same keys (returning only the last line of each unique key).

<#ForSale:unique,table>
Key Description Price
123 Short sleave shirt 19.95
124 Long sleave shirt 24.95
uniquecount Returns a list of pairs of all the unique cells and how many of them respectively.

<#ForSale:uniquecount> 123=1,124=1
uniquecount="" Returns a list of pairs of all the unique cells and how many of them respectively.

<#ForSale:uniquecount="Description"> Long sleave shirt=1,Short sleave shirt=1