Forum Discussion

cmholden's avatar
cmholden
Regular Visitor
4 years ago
Solved

Access Properties with empty DataView

I am reposting this question here as I think I posted on an incorrect forum - apologies.

 

I am developing a custom visual that on some occasions does not need any input data from the Fields and hence the DataView is empty. Using the following in capabilities.json:

 
"supportsEmptyDataView"true,
 
This works fine. 
 
The problems arises with the property settings in the update function. I have a popup dialog that allows a user to set a hidden property and then stores the result in the  visual class with:
 
this.visualHost.persistProperties(objects);
 
When I access the properties in update() with; 
 
this.visualSettings = VisualSettings.parse<VisualSettings>(dataView);
 
This again works fine if there is data in the DataView. However, with no data, only the default values are returned. I also notice that if I manually set a property as a user, the missing property then becomes available in the update method - so the data are actually there but not processed unless a data field is added or a property updated. 
I imagine that there is a call made somewhere the does this in the background i.e forces the properties to be enumerated. Is it possible to fire this programatically so that I don't have to force the user to add a dummy data field - or is there some other way of making the property available?

2 Replies