Forum Discussion

b4ckup's avatar
b4ckup
Regular Visitor
6 years ago

DataView holds values even though the Measure was removed

Hi,

Today I encountered some strange behavior with the update call to my custom visual.

I have a custom visual with the following dataViewMappings

"dataViewMappings": [
    {
      "categorical": {
        "categories": {
          "for": {
            "in": "x"
          },
          "dataReductionAlgorithm": {
            "window": {
              "count": 1000000
            }
          }
        },
        "values": {
          "group": {
            "by": "legend",
            "select": [
              {
                "for": {
                  "in": "y1"
                }
              },
              {
                "for": {
                  "in": "y2"
                }
              }
            ],
            "dataReductionAlgorithm": {
              "top": {
                "count": 60
              }
            }
          }
        }
      }
    }
  ],

I now create a new instance of my custom visual in powerbi service and add a measure to the x dataview mapping. In the update function the first thing I do is log the options argument

public update(options: VisualUpdateOptions) 
{
    console.log(options)
    //...further irrelevant code here
}

 What I see is I get dataViews[0].categorical filled with some structure.

No I remove the Measure from my visual but dataViews[0].categorical still remains the same in the next update call. Even dataViews[0].metadata has an element that indicates that the x dataViewMapping is filled, which it isn't anymore. The same holds true if I fill any other dataViewMapping and then remove it. The behavior is not restricted to x.

Also when I fill two dataViewMappings like x and y and I delete for example y then the dataView I get as argument in update() no longer holds values or metadata for the y measure. This is the behavior I expected.

Did anybody also run into this issue? Is there maybe an underlying reason for this or does this even make sense somehow?

 

Thanks in advance

No RepliesBe the first to reply