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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
danieleperilli
Kudo Commander
Kudo Commander

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))
    Screen Shot 2015-12-04 at 21.31.13.png
  • When formatting a value (the following function return an empty string):
    dataLabelUtils.getLabelFormattedText(MEASURE, WIDTH, FORMAT_STRING, MEASURE_FORMATTER);

These issues affect the online version only, not the desktop (with the same code, of course).

Can you help me?

1 ACCEPTED SOLUTION
sgrebnov
New Member

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

View solution in original post

3 REPLIES 3
sgrebnov
New Member

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

Thank you very much!

Is there a release date for the Power BI Desktop update that contains this fix?

sgrebnov
New Member

Confirm this issue:

 

 

value
SQConstantExpr {type: ValueType, value: "https://www.sqlbi.com/synopticdesign/wp-content/up…s/sites/251/2015/12/gallery_map_1449167366471.svg", valueEncoded: "'https://www.sqlbi.com/synopticdesign/wp-content/u…/sites/251/2015/12/gallery_map_1449167366471.svg'"}

data.SQExprBuilder.text(value)
data.js:3983 Uncaught TypeError: is not a function(…)

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.