Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
nmathieu
Contributor
Contributor

QLik Sense LiveTable Editing Data

Hi ALl,

 

I am setting up the Qlik Live Table so as to be able to connect with SQL Database and edit directly the database on the dashboard

I have the Javascript code related to the save data here below

$(document).on("click"".saveData"function(){

                //get values from table
                values = {};
                $('.editable').each(function(indexitem) {
                    if($(item).attr('id') != qKeyField){
                        values[$(item).attr('id')] = $(item).val();
                    }
                });
                if(qDebug){
                    console.log('JSON Sent: ' + JSON.stringify(myJSON))
                }
                //add new values to JSON (filters should still match single record)
                myJSON["values"] = values;
                //Send JSON to the REST API using fetch and get result
                var fetchData = { 
                    method: 'PUT'
                    body: JSON.stringify(myJSON),
                    headers: {
                      'Accept': 'application/json',
                      'Content-Type': 'application/json'
                    }
                }
                fetch(qRestAPIfetchData)
                .then((resp=> resp.json()) // Transform the data into json
                .then(function(data) {
                    if(qDebug){
                        console.log('JSON Received: ' + JSON.stringify(data))

 

 

I am getting this error when clicking on Save data button:

There was an error fetching the data from LiveTable REST API : SyntaxError : Unexpected token < in JSON at position 0

I know the JSON might not be in a correct format but I don't know honestly how to troubleshoot it, 

Could you please help ?

 

Thanks a lot in advance

0 Replies