Relational sheets refer to the ability to link two sheets, allowing data from a secondary sheet to be accessed via a "_text" dimension in the primary sheet.
[* fetch_cell( name=> 'survey_id.primary_sheet_id', row => 101, column => 'QP1A2_text', secondary => 1) *]
To create this link, specify the secondary sheet name below the column headings and use a 'map' row to define reference columns. Then, use fetch_cell
to retrieve the data.
Example
Secondary sheet
The associated secondary sheet with the ID 'labels' has the following contents:
id | A1 | A2 | A3 | A4 |
1 | AMD Athlon II X2 B26 3.2GHz | 512MB | 300GB | $389.99 |
2 | AMD Phenom II X4 B97 3.2GHz | 1GB | 750GB | $482.59 |
3 | Intel Core i3 i3-2120 3.3GHz | 2GB | 800GB | $625.99 |
4 | Intel Core i5 i5-2400 3.1GHz | 3GB | 1TB | $729.89 |
5 | Intel Core i7 i7-2600 3.4GHz | 4GB | 2TB | $948.95 |
6 | Intel Celeron G530 2.4GHz | 6GB | $1,259.59 | |
7 | 8GB | $1,379.49 | ||
8 | 10GB | $1,439.89 |
Primary sheet
In the sheet below, the secondary sheet 'labels' is referenced beneath the headings, with mappings defined in the next row.
id | QVERS | QTASK | QP1A1 | QP1A2 | QP1A3 | QP1A4 |
##secondary | labels | |||||
##map | A1 | A2 | A3 | A4 | ||
101 | 1 | 1 | 1 | 1 | 1 | 1 |
102 | 1 | 2 | 3 | 4 | 5 | 3 |
103 | 1 | 3 | 5 | 5 | 1 | 5 |
104 | 1 | 4 | 4 | 1 | 3 | 5 |
105 | 1 | 5 | 6 | 2 | 1 | 2 |
106 | 1 | 6 | 2 | 3 | 4 | 8 |
107 | 1 | 7 | 1 | 3 | 2 | 7 |
108 | 1 | 8 | 5 | 7 | 5 | 4 |
The above arrangement allows the text in the 'labels' sheet to be accessed via reference to the primary sheet.
'fetch_cell' code
The code below returns the value in row 101's QP1A2 cell from the primary sheet.
[* fetch_cell( name=> 'survey_id.primary_sheet_id', row => 101, column => 'QP1A2') *]
This code returns the value in linked in the secondary sheet for the same cell.
[* fetch_cell( name=> 'survey_id.primary_sheet_id', row => 101, column => 'QP1A2_text', secondary => 1) *]
Comments
0 comments
Please sign in to leave a comment.