Comment on page
useVariable
Use the hook with no input parameters (returns a list of variables)
const {
qLayout,
qInfo,
qMeta,
qSelectionInfo,
qVariableList
variableList,
} = useVariable();
You can also pass
qId
or qName
as parameters. This will return data and actions for a specific variable.const {
qLayout,
qInfo,
qNum,
qText,
value,
error,
qProperties,
setProperties
} = useVariable({ name: “name" });
Pass
qName
and qDefinition
to create a session variableconst {
qLayout,
qInfo
} = useVariable({
name: "name",
definition: "=Count(Country)",
});
The following options can be passed into the hook
name: String
- The name of the variable to use. Combine with
qDefinition
, or pass on it's own to retrieve information from the engine
definition: String
- Variable expression
The following properties are returned from the hook
qLayout: Object
- Layout of the variable
- Returns an object with the following keys if no variable is passed into the hook
qInfo: {qId: "...", qType: "...."}
qMeta: {privileges: Array(3)}
qSelectionInfo: Object
qVariableList: {qItems: <Array>}
variableList: <Array[Obj]>
- Returns an object with the following keys if a variable is passed into the hook
qInfo: {qId: "...", qType: "...."}
qMeta: {privileges: Array(3)}
qText: String
qNum: Number
value: String
- The above properties in qLayout are also available de-structured from the hook, see the usage examples above
Last modified 2yr ago