Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

dataView doesn't have objects in metadata untill we select it from format option.

(using power bi custom visual in web version(latest))

 

I have defined an object of enumeration type in capabilities.json:

 

"objects": {
"MyObj": {
"displayName": "Object type",
"properties": {
"topType": {
"displayName": "select",
"type": {
"enumeration": [{
"value": "type1",
"displayName": "Type 1"
}, {
"value": "type2",
"displayName": "Type 2"
}, {
"value": "type3",
"displayName": "Type 3"
}
}]
}
}
}
}
}

 

requirement is: 

In UI user will have option to select type1, type2 or type3. Once user select any of these and click "proceed"  button, that type should get updated in format option as default selection for object "Object type".

 

current approach:

i am updating the type that user selects in a global variable. once the user clicks on button i am calling "enumerateObjectInstances" method with that value as default settings in update method.

update(...){

...

this.typeSettings.MyObj.topType=selectedValue;

let enumObj={"objectName":"MyObj"}
let e=cur2.enumerateObjectInstances(enumObj);

}

 

public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
let objectName = options.objectName;
let objectEnumeration: VisualObjectInstance[] = [];
switch (objectName) {
case "MyObj":
let MyObj: VisualObjectInstance = {
objectName: "MyObj",
displayName: "Object type",
selector: null,
properties: {
topType: this.typeSettings.MyObj.topType,   //this i am updating as per user selection
}
};
objectEnumeration.push(MyObj);
break;
};

return objectEnumeration;
}

 

for this code if i am in format option and click "proceed" button, no change in selected value of object is coming although "enumerateObjectInstances" is called for this click(coming in logs). After this when i go to fields option and again coming back to format option the selected type is getting reflected. Any idea why this is happening??

 

Also, for update dataViews, "options.dataViews[0].metadata.objects" are coming only when we select some other data form format option. Any idea how to get "options.dataViews[0].metadata.objects" on first update without any toggle in format option???

 

Please help!!

 

Thanks..

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Hello @Anonymous,

 

This topic looks like a duplicate of this one.

Please take a look at that topic to find out more.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

1 REPLY 1
v-viig
Community Champion
Community Champion

Hello @Anonymous,

 

This topic looks like a duplicate of this one.

Please take a look at that topic to find out more.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.