Write back in Qlik Sense using widgets

    This widget was created to enable write back to a MySQL DB so it is possible to make comments. This means you need to have a web hotel that supports MySQL DB and PHP or create this locally on your machine using something else than PHP.

    Please take a look at the PHP script included in this article and create a MySQL DB table that you make the comment to. Also make sure that the PHP script is connected to the correct columns.

     

    Step 1. Import widget into Sense using the Dev Hub and add it to an app.

    Step 2. Select a dimension that the widget should make an comment to in the setting for the widget under Title. (This is a hidden drop down menu in the widget)

    Step 3.

    Go to Dev-Hub an open the widget and change the location where you store the php script. http://servername/insert.php. I used a web hotel where I also have a MySQL DB where the comments are stored. You can use the widget as a base and change this to be used with

    another type of database and skip PHP if you like.

    The widget is dynamically so in my example I connected it to a dimension called Division which means when I click on for example a bar chart and select division Sweden that selection is connected to my widget so the comment is made for Sweden.

    Step 4.

    Press the send button and then the PHP script is called and the comment is inserted into the MySQL database.

     

    Step 5.

    Click on reload app (there is an widget for this as well). You can create a new widget and just paste this code into the HTLM space:

    <div>
    <lui-button ng-click="app.doReload()">Reload app</lui-button><br>
    </div>

    Please take a look at this video how this works:

     

     

    Files to download:

    insert.php (PHP script to insert data into a MySQL DB)

    writebackshare.zip (widget to be used in Sense)

     

    Regards Sam Bäcknäs (scb@qlik.com)