Forum Discussion
Custom Object Drowdown
- 9 years ago
Anonymous,
You may refer to capabilities.json of Dual KPI and view its source code at https://github.com/Microsoft/powerbi-visuals-dualkpi. As for the spec, see https://github.com/Microsoft/PowerBI-visuals-tools/blob/164f80e7e269f56dbbfd8009e4d860c7c03b4f07/templates/visuals/.api/v1.6.0/schema.capabilities.json.
Anonymous,
You may refer to capabilities.json of Dual KPI and view its source code at https://github.com/Microsoft/powerbi-visuals-dualkpi. As for the spec, see https://github.com/Microsoft/PowerBI-visuals-tools/blob/164f80e7e269f56dbbfd8009e4d860c7c03b4f07/templates/visuals/.api/v1.6.0/schema.capabilities.json.
Awesome thanks! That's a great resource.
I'll put the code here for others to see an example.
Capabilities.json:
"displayUnits": {
"displayName": "Display Units",
"type": {
"enumeration": [{
"value": "none",
"displayName": "None"
}, {
"value": "thousands",
"displayName": "Thousands"
}, {
"value": "millions",
"displayName": "Millions"
}, {
"value": "billions",
"displayName": "Billions"
}]
}
}And the enumeration is the same as you would get a string.
- Anonymous9 years agoNot applicable
Can you put up enumeration code as well, I tried and it is not working properly
- Anonymous9 years agoNot applicable
It's just like any string:
public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration { let objectName = options.objectName; let objectEnumeration: VisualObjectInstance[] = []; switch(objectName) { case 'kpi': objectEnumeration.push({ objectName: objectName, properties: { displayUnits: this.kpiSettings.kpi.displayUnits }, selector: null }); break; }; return objectEnumeration; }- PBIcustomizer8 years agoFrequent Visitor
Hi,
Here, the possible options are hard-coded in capabilities.json.
Is there a way to dynamically specify the list of possible values?
- v-chuncz-msft9 years agoCommunity Support
Anonymous,
If your problem has been resolved, please help mark answer. Your contribution is highly appreciated.