Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello,
I have encoded a heap of images as base64 and stored them in a dict, currently, it is making a mess in my visual.ts file, it's super long. Is there any way I can store these in another file and call the variable when needed? I have been banging my head against the wall for a while.
Thank You
Solved! Go to Solution.
Hi @BrentonC,
Note that you don't have to use these exact names, just make sure everything links together, e.g. the constant name and the file it's sourced from.
Also, the export in front of your const declaration in step 3 is very important, otherwise it's not 'visible' to other files when you try to import it.
If you want to see a pre-canned example within your project (assuming you started with a blank visual), your settings.ts does the same thing with the VisualSettings class declaration, and its subsequent import into visual.ts.
Here's some further reading on ES6 imports and exports.
Good luck!
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @BrentonC,
Note that you don't have to use these exact names, just make sure everything links together, e.g. the constant name and the file it's sourced from.
Also, the export in front of your const declaration in step 3 is very important, otherwise it's not 'visible' to other files when you try to import it.
If you want to see a pre-canned example within your project (assuming you started with a blank visual), your settings.ts does the same thing with the VisualSettings class declaration, and its subsequent import into visual.ts.
Here's some further reading on ES6 imports and exports.
Good luck!
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Thank you, it did have an issue with me trying to import './constants.ts' as it did not want the extension on there so './constants' did the job. I am not very familiar with javascript/node.js, best I do some reading up on it and learn the fundamentals. Thank you for the good explanation.
Brenton Collins
Glad to hear it's working for you, and thanks for the feedback on the file extension - I'll update the answer with the correct info 🙂
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
3 | |
3 | |
3 | |
2 | |
2 |