Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

sushil353
Honored Contributor 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
Honored Contributor

how to call a javascript function in qlikview ??

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

how to call a javascript function in qlikview ??

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
Honored Contributor II

how to call a javascript function in qlikview ??

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

chauhans85
Esteemed Contributor

how to call a javascript function in qlikview ??

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

sushil353
Honored Contributor II

how to call a javascript function in qlikview ??

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

chauhans85
Esteemed Contributor

how to call a javascript function in qlikview ??

sorry Bro i thing it was javasscript.

see the link below

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

hope this help

how to call a javascript function in qlikview ??

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
Honored Contributor II

how to call a javascript function in qlikview ??

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

Employee
Employee

Re: how to call a javascript function in qlikview ??

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

Community Browser