Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

agigliotti
Honored Contributor II

Data entry in Qlik Sense writing to database

Hello,

Our customer ask us to be able to do data entry ex. for budgeting inside a Qlik Sense app.

I looked at the branch but I did not find any extensions regarding this topic.

I'd like to prototyping a simple HTML table with two columns (ex. last year amount sold and current year budget) for all customers.

That is a simple HTML form with an input text for budget entry for each customer.

After the form is submitted the data should be written on database table (ex. MySql or others).

Could someone guide me to the right direction to achieve it ?

Many thanks in advance.

Best Regards

Andrea

23 Replies
charlie_mstrmnd
New Contributor III

Re: Data entry in Qlik Sense writing to database

Hi Andrea,

In the first instance it maybe worth reviewing SQL Writeback from QlikView extension object.

First I would put together a simple table extension, or take one from Qlik Branch. Would then embed a form/button calling an external PHP page with the values to write back.

Charlie

agigliotti
Honored Contributor II

Re: Data entry in Qlik Sense writing to database

thanks for your suggestion...

i'm working around developing an extension using angluarjs and making a jquery ajax call to nodejs with expressjs to write back form parameters to postgres database table.

Now I'm in troubles with the jquery ajax call because it seems to work only in GET method...even I specified type = POST

below my extension js code:

$.ajax({

  type: "GET",

  url: "http://localhost:3000/endpoint",

  data: jsonTxt,

  crossDomain: "true",

  contentType: "application/json; charset=utf-8",

  dataType: "jsonp",

  jsonpCallback: 'callback',

  cache: false,

  async: false,

  jsonp: 'jsonp',

    success: function( resp ) {

            alert('SUCCESS !!!');

            console.log( resp ); // server response

  },

    error: function() {

             console.log('Uh Oh!');

    }

      

});

working via GET request the url I get is like below:

http://localhost:3000/endpoint?jsonp=callback&{%22firstName%22:%20%22dvv%22,%22lastName%22:%20%22vcv...

and at server side using express js the parse function return an error parsing the request as below

var query = url.parse(req.url).query

JSON.parse(decodeURIComponent(query))

It would expect the following url:

http://localhost:3000/endpoint?{%22firstName%22:%20%22dvv%22,%22lastName%22:%20%22vcvccv%22}

What does it means "jsonp" and "_" parameters in query string ?

while forcing post method in jquery ajax (using $.post rather than $.ajax) the url called is like below:

http://localhost:4848/sense/[object%20Object]

I can't understand why !!!

In both way I have some problem.

Can anybody help me to fix it ?

Many thanks in advance.

Best Regards

Andrea

Employee
Employee

Re: Data entry in Qlik Sense writing to database

What happens if you use $.post() instead of $.ajax()?

agigliotti
Honored Contributor II

Re: Data entry in Qlik Sense writing to database

as i wrote above I get the following url:

http://localhost:4848/sense/[object%20Object]

but I was expecting the same specified in the ajax call...!?

Employee
Employee

Re: Data entry in Qlik Sense writing to database

It seems to be a Cross domain issue https://zinoui.com/blog/cross-domain-ajax-request

Please put

alert(window.location); at somewhere into your code

agigliotti
Honored Contributor II

Re: Data entry in Qlik Sense writing to database

I get as below:

WL.jpg

agigliotti
Honored Contributor II

Re: Data entry in Qlik Sense writing to database

I really don't understand why using type: "POST" it seems to be ignored... because it still uses GET method !!!

Employee
Employee

Re: Data entry in Qlik Sense writing to database

As you pointing to same server but different ports (3000 x 4848) is considered a Cross Domain Post (Are different ports on the same server considered cross-domain? (Ajax-wise) - Stack Overflow)

When a Cross Domain Post occurs, it´s not possible to make a POST request using Ajax unless you configure to enable it

javascript - how to solve cross domain in ajax - Stack Overflow

javascript - What is the cross domain issue - Stack Overflow

Employee
Employee

Re: Data entry in Qlik Sense writing to database

Please take a look at my last answer, that´s why your POST is being ignored