Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sushil353
Master II
Master II

how to call a javascript function in qlikview ??

Hi All,

I am new to this functionality of qlikview. i have a function to call a webpage using post method. but how do i call it using a button in my qlikview dashboard as it is written in javascript and edit module of qlikview is not supporting javascripts.

Please help me out to solve this issue. i have not provided the url in action due to security reasons..

   function callCND(){

                  var myForm = document.createElement("form");

                  myForm.setAttribute("action", "http://xyz");

                  myForm.setAttribute("method", "POST");

                  myForm.setAttribute("target", "_blank");

                  var myunitrpt = document.createElement("input") ;

                  var myexid = document.createElement("input");

                  myunitrpt.setAttribute("name", "UNITRPT") ;

                  myunitrpt.setAttribute("value","history");

                  myForm.appendChild(myunitrpt) ;

                  myexid.setAttribute("name", "EX_ID") ;

                  myexid.setAttribute("value","1093981623");

                  myForm.appendChild(myexid) ;

                  document.body.appendChild(myForm) ;

                  myForm.submit() ;

  document.body.removeChild(myForm) ;

}

Thannks in advance

Sushil

14 Replies
Sokkorn
Master
Master

Hi Sushil,

Maybe this one cannot help you, but we need to try first by Go to Actions ==> Add ==> External ==> Run Macro ==> Put the function name in the box

Regards,

Sokkorn Cheav

Not applicable

It sounds like you want to display a webpage within a qlikview app. for that you would need to look into extensions. Qliktiech has provided a WebPageViewer extension example in their example code. Have a look at that.

sushil353
Master II
Master II
Author

this is a javascript function to  call a webpage using post method...

my problem is... as i am not able to invoke this function using edit module of qlikview....

If u know how to call a webpage using post method using VB script which is supported by qlikview. then my problem will be resolved

Thanks

SunilChauhan
Champion
Champion

Button->Properties->Go to Actions ==> Add ==> External ==> Run Macro ==> Put the function name in the box

Control +M _> check on javascript -> write here your function.

hope this may help you

Sunil Chauhan
sushil353
Master II
Master II
Author

Hi Sunil,

I did the same thing but i am getting error that 'document is undefined'.. One more thing i want to share is.. qlikview spport JSCRIPT not the javascripts.

have a look in the screen shot below

untitled.JPG

SunilChauhan
Champion
Champion

sorry Bro i thing it was javasscript.

see the link below

http://community.qlik.com/message/150603#150603

hope this help

Sunil Chauhan
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Jscript and Javascript are pretty much equivalent. However, I don't think you can manipulate the DOM (browser) document object directly from module code. You have a few alternatives I can think of:

1. Use a GET url instead with a button Action External->Open URL.

2. Use the module, but use XmlHttp Post. (http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp)

3. Code it up in an extension object.

-Rob

http://robwunderlich.com

sushil353
Master II
Master II
Author

Hi Rob,

Thanks for your reply..

let me tel you the complete scenario.. we want to call COGNOS reports from qlikview. so we need to submitt user selection using post beacause cognos reports can be invoked using post method...

is that possible to write something similar in VB Script. i dont know the VB script thats why i am stuck in this issue..

Please share if you have some idea.

Thanks

Sushil

Alexander_Thor
Employee
Employee

Hi Sushil,

You can't invoke javascript functions from a QlikView button.

The Extension Objects allows you to to create custom visualizations in QV so you could create your own button in your script instead.

This is a small sample someone wrote, can't remember who, that you could look at.

Download and doubleclick the postdata.qar file, Enable Webview in qlikview, right-click an add sheet object, drag and drop your post data extension into your app.

If you want to look at the code you can find it at C:\Users\%username%\AppData\Local\QlikTech\QlikView\Extensions\Objects\PostData

post.PNG