Forum Discussion

danieleperilli's avatar
danieleperilli
Kudo Commander
10 years ago
Solved

Errors on custom components (when persisting data and format label)

Hi,  from yesterday my custom visuals have some issues when calling the following functions (that woked before):    When persisting data: powerbi.data.SQExprBuilder.text(String(ANY_DATA))...
  • sgrebnov's avatar
    10 years ago

    Looks like you are passing SQConstantExpr type value (as per powerbi.data.SQExprBuilder.text() call) where persistProperties  method requires DataViewPropertyValue, so the following code works in both Desktop and Online:

     

                    SynopticPanelBySQLBI.prototype.persistData = function () {
                        var properties = {};
                        properties.imageData = (this.data.imageData ? this.data.imageData : '');
                        //properties.imageData = (this.data.imageData ? powerbi.data.SQExprBuilder.text(String(this.data.imageData)) : '');
                        this.host.persistProperties({
                            merge: [{
                                objectName: 'general',
                                selector: null,
                                properties: properties,
                            }]
                        });
                    };

    PS. It works in Desktop as changes in SQExprBuilder have not been reflected to Desktop yet. Using primitive type instead of SQExprBuilder is correct way here.

     

    Thx!

    Sergey