Tables in Snippets
Quick Overview Video
Tables are made up of columns and rows similar to spreadsheets. They can contain static unchanging information, contain dynamic commands, and they can be dynamically created using rules.
Creating tables in snippets
Adding a table
To add a table to a snippet, click on the table icon in the formatting options.
Use the grid that appears to define how many columns and rows the table should have. Columns and rows can both be deleted or added once the table is created, too.
Changing column widths and order
Above the table that is created, you'll see an additional small row. This row doesn't contain any of your table's data, but can be used to adjust the column widths and the order of the columns.
By default, columns are set to 100 pixels wide. To adjust the column width, click on the line dividing the cells and drag left or right. The number of pixels wide that column will be is briefly displayed for easy reference.
Click on one of these smaller cells and drag it to change the location of a column in the table.
Adding and deleting rows and columns
Selecting a cell of a table and then right-clicking inside of it will present a menu with many table options.
To add a column, choose "Insert column right" or "Insert column left" from the menu.
To add a row, choose "Insert row above" or "Insert row below" from the menu.
Deleting rows and columns are also done from this menu. Deleting a row or column will delete the selected row or column, so be sure that the right data is selected before deletion.
Formatting a table
Text formatting
Formatting of the text inside of a table is primarily done using the formatting options at the top of the snippet. This includes options like bold, italics, underline, and strikethrough text, as well as font, font color, and font size.
Cell and table formatting
To access additional formatting options, highlight the cells that you want to change and then right-click them. Choose "Format cells..." from this menu.
Cell background and border color can be set here, as well as the border width, style, and sides. Cell contents text can also be aligned both vertically and horizontally.
Cells can also be merged together through the "Merge selected cells" option in the right-click table menu.
Dynamic content in tables
Commands within a table
All Text Blaze dynamic commands can be included in a table the same way they're used elsehwere in snippets.
Form fields make it easy to customize and personalize a table's content each time the snippet is used.
Formuas can be used to automatically calculate data that's contained inside of a table.
{note}{formtoggle: name=Include professional services?}
{endnote: trim=left}
Product | # Licenses | Monthly Price Per User | Annual Cost |
---|---|---|---|
Basic | {formtext: name=basic; cols=5} | ${formtext: name=bprice; default=10; cols=5} | {btotal=(basic*bprice)*12}{=btotal; format=$.2f} |
Pro | {formtext: name=pro; cols=5} | ${formtext: name=pprice; default=15; cols=5} | {ptotal=(pro*pprice)*12}{=ptotal; format=$.2f} |
Advanced | {formtext: name=advanced; cols=5} | ${formtext: name=aprice; default=20; cols=5} | {atotal=(advanced*aprice)*12}{=atotal; format=$.2f} |
{if: `Include professional services?`}Professional Services | N/A | N/A | {proserv=5000}{=proserv; format=$.2f}{endif} |
Total due for licenses: {if: not `Include professional services?`}{=btotal+ptotal+atotal; format=$.2f}{else}{=btotal+ptotal+atotal+proserv; format=$.2f}{endif}
Additional dynamic commands that work well with tables are date and time and clipboard.
Conditionally display table contents
Rules, or conditional logic in a snippet can apply to tables. Rules can apply to individual cells, or entire rows of the table.
To apply a conditional rule to a single cell, click on the cell and add the If/Else condition command from the list of commands on the right side of the editor.
To apply a conditional rule to an entire row, right-click on one of the cells in that row and select "Conditionally show row". Write the condition that controls your rule in the pane that appears.
Advanced table usage
Automatically create a table from Data Blaze
When using the "Read from table" command to retrieve data from Data Blaze, it's possible to automatically create a table with the data that is returned.
This works when the Read from table command is set to multiple=yes and has been given a name.
To automaticaly create a table, click on the "..." button next to the name of the variable in the dbselect command, and choose "Insert table". This will automatically create a table with a repeat command in it. This command will automatically create a table that matches the data being retrieved from Data Blaze.
Adding a repeat to a table
The repeat command repeats its contents as many times as specified. Using a repeat inside of a table can make it easy to add multiple duplicate lines to a table. It is also useful with list comprehension for creating a new row in a table for each item inside of a list.