Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've created an extension in which I want users to be able to enhance their Measures by entering an expression string to specify, in this case, a color value. For example, "= if (count(foo)>10,vRed,vGreen)".
I've got the expression field displaying okay using the following:
definition: {
type: "items",
component: "accordion",
items: {
dimensions: {
uses: "dimensions",
min: 2,
max:2
},
// measure value is either bar/line length or type of point object
measures: {
uses: "measures",
min: 1,
max: 6,
type:"items",
items: {
VisualType: {
type: "string",
component:"dropdown",
label: "Visual Type",
ref: "qDef.visualType",
options: [{
value: "BAR",
label: "Bar"
},{
value: "LINE",
label: "Line"
},{
value: "POINT",
label: "Point"
}],
defaultValue: "BAR"
},
// this evaluates to a number for each row.. qAttrExps.qValues[0].qNum
ColorExp: {
type:"string",
label:"Color Expression",
ref:"qAttributeExpressions.0.qExpression",
expression:"always",
defaultValue:""
}
}
},
sorting: {
uses: "sorting"
},
appearance: {
uses: "settings",
type: "items",
items: { ....
The problem is that after specifying the expression string, if I go back into Edit mode, the expression is blank.
I've tried removing the defaultValue line but that didn't have an effect.
Am I missing a step or attribute required to make the expression persist?
Thanks,
Steve
Looks like I need to use component:"expression", instead of expression:"always".