Difference between revisions of "Command/datasetvariable"

From ConTeXt wiki
 
Line 4: Line 4:
 
}}
 
}}
  
== [[Help:Reference|Syntax]] (autogenerated)] ==
+
== [[Help:Reference|Syntax]] (autogenerated) ==
 
<syntax>datasetvariable</syntax>
 
<syntax>datasetvariable</syntax>
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==

Latest revision as of 14:49, 13 October 2019

\datasetvariable

Syntax (autogenerated)

Syntax

\datasetvariable{...}{...}{...}
{...} name of data set
{...} name or number of table in data set
{...} variable name


Description

\datasetvariable{mydataset}{mytable}{myvariable}

This command retrieves the value of myvariable in the table mytable stored in the dataset mydataset. Two complete examples are shown below.

Usage

% Define a dataset called 'mysteries'
\definedataset[mysteries]

% The first anonymous table is stored at position 1, the second at position 2, etc.
\setdataset[mysteries][assistant=Watson]

% Retrieving an anonymous table
\datasetvariable{mysteries}{1}{assistant}  % Watson

or

% Define a dataset called 'mysteries'
\definedataset[mysteries]

% Store a key-value dataset called 'Doyle'
\setdataset[mysteries][Doyle][detective=Holmes, assistant=Watson, officer=Lestrade]

% Retrive the variable 'assistant' from the 'Doyle' table in the 'mysteries' dataset
\datasetvariable{mysteries}{Doyle}{assistant}  % Watson

See also

  • \definedataset to define a dataset for storing key-value tables
  • \setdataset to store key-value tables in a dataset
  • More detailed explanations and examples can be found in the Key-Value Assignments article, under the section Multi-pass data.


Help from ConTeXt-Mailinglist/Forum

All issues with: