Category:Testing >> Category:Core >> Category:Web >> DocSpreadsheetExamples 

TB Wiki

Login

DocSpreadsheetExamples

Here are some examples of spreadsheet functionality in TBWiki tables

simple spreadsheet [edit section]

table not a spreadsheet [edit section]

Here is the data, without the "is_spreadsheet" attribute
Name  ^ count  ^ cost  ^ total  ^
shoes 2 .30 =2*.30
shirts 3 1.50 =3*1.50
Query
missing column 'calculation' in table

table as spreadsheet [edit section]

Here is the data, with the 'is_spreadsheet' attribute:

Name  ^ count  ^ cost  ^ total  ^
shoes 2 .30 0.6
shirts 3 1.50 4.5
Query
missing column 'calculation' in table

complex spreadsheets [edit section]

simple arithmetic [edit section]

Name  ^ test  ^ num1  ^ num2  ^ formula  ^ calculation  ^ expected value  ^
multiplication2 reference multiplication 2.6 1.5 f=$.num1 * $.num2 3.9 3.9
addition2 reference addition 2 7 f=$.num1 + $.num2 9 9
subtraction2 reference subtraction 3 1.10 f=$.num1-$.num2 1.9 1.9
division2 reference division 7.0 2 f=$.num1 / $.num2 3.5 3.5
addition literal addition 2 7 f=2+7 9 9
multiplication literal multiplication 2.6 1.5 f=2.6*1.5 3.9 3.9
subtraction literal subtraction 3 1.10 f=3-1.10 1.9 1.9
division literal division 7.0 2 f=7.0/2 3.5 3.5
Query

complex formulas [edit section]

The following table has relative references, functions (SUM),
Name  ^ test  ^ count  ^ cost  ^ formula  ^ total  ^ expected value  ^
candy simple formula 2 .30 f=2*.30 0.6 0.6
socks simple formula 3 1.50 f=3*1.50 4.5 4.5
shoes simple ref 6 2.00 f=$shoes.count 6 6
shirts expression 3 12.95 f=$.count * $.cost 38.85 38.85
sub-total sum function . . f=SUM($candy.:$shirts.) 49.95 49.95
sub-count sum of count 14.0 . f=SUM($candy.count:$shirts.count) 14.0 (see 'count' column)
Query
missing column 'calculation' in table

multiplication table [edit section]

.  ^ rval  ^ col1  ^ col2  ^ col3  ^ col4  ^ col5  ^ col6  ^
cval . 1 2 3 4 5 9
row1 1 1 2 3 4 5 9
row2 2 2 4 6 8 10 18
row3 3 3 6 9 12 15 27
row4 4 4 8 12 16 20 36
row5 5 5 10 15 20 25 45
row6 7 7 14 21 28 35 63
Query
missing column 'calculation' in table

test cell references [edit section]

row_label  ^ test  ^ formula1  ^ formula2  ^ col4  ^ col5  ^ expected value1  ^ expected value2  ^
row1 (data) none none 7 15 7 15
row2 previous cell in columm (this row, column-1) none f=$.-1 + 1 11 12 11 12
row3 previous cell in row (row-1, this column) f=$-1. * 2 none 22 no value 22 no value
row4 absolute numeric reference to literal f=$00001.4 + 1 none 8 . 8 .
row5 absolute numeric reference to literal f=$00001.5 + 1 none 16 . 16 .
row6 named reference to literal f=$row1.col4 f=$row1.col5 7 15 7 15
row7 named reference to formula result f=$row2.col5 f=$row5.col4 12 16 12 16
row8 absolute numeric reference to formula result f=$00002.5 f=$00005.5 12 16 12 16
row9 forward reference to a literal f=$row12.col4 f=$row12.col5 49 43 49 43
row10 forward relative reference to a literal f=$+2.col4 + 12 f=$+2.-1 * 2 61 98 61 98
row11 forward reference to a formula f=$row13.col4 f=$row13.col5 =49 + 5 =43 + 5 54 48
row12 (data) none none 49 43 49 43
row13 named reference to a literal f=$row12.col4 + 5 f=$row12.col5 + 5 54 48 54 48
Query
missing column 'calculation' in table

Categories: Documentation|Tables
TBWiki engine 2.0.1 by Tim Bird