Forum Discussion

PMAnalytics's avatar
PMAnalytics
Frequent Visitor
3 years ago

Possibility to store values via the frontend (Visual)

Hi,

 

is it possible that the user can enter a value via the frontend (directly in the visual)? The value should be saved permanently afterwards. So instead of loading a value via the sidebar, he/she should be able to enter something directly in the visual.

 

I have managed so far that a value is loaded and saved via an object. However, when the report is reloaded, the value is not saved. Is it correct that the settings for each visual is saved via capabilities.json and that I would have to try to get to these settings? With my current solution, nothing is saved and a new empty object is created when the report is loaded.

 

Many greetings and thanks in advance

2 Replies

  • You can add the field into the capabilities file and then hide it.

     

    After that, create an input field in the visual and use `powerbi.VisualObjectInstancesToPersist` to save the value.

     

    I don't know anymore where I got this example from, but below you can find a code snippet that worked for me.

     

    ```

    const objects: powerbi.VisualObjectInstancesToPersist = {
    merge: [
    {
    objectName: 'mapConfiguration',
    selector: undefined,
    properties: {
    mapJSONCustom: customJSON,
    },
    }],
    };

    this.host.persistProperties(objects);
    ```

     

     

  • Imagine you have many users accessing your visual in the Power Bi service.  How is the service supposed to know how to store the data for the individual users?