cancel
Showing results for 
Search instead for 
Did you mean: 

getQueryObject(): undefined is not a function

0 Kudos

Hi,

when running the application in Chrome, I'm receiving the following error message:

Uncaught TypeError: undefined is not a function

(anonymous function)

and this point to the line:

var someObject = document.SomeApplet.getQueryObject();

I'm not receiving this error message in IE or Firefox. How to resolve the issue?

Thx

Accepted Solutions (1)

Accepted Solutions (1)

former_member185280
Active Contributor
0 Kudos

Have you made sure your applet is fully loaded an initialized before you make your call to the getQueryObject function?

0 Kudos

Yes, it works in other browsers, problems are just in Chrome

<APPLET name="SomeApplet" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="0px" HEIGHT="0px" MAYSCRIPT="mayscript">

  <PARAM NAME = "QueryTemplate" VALUE="some_valid_path_to_Xacute_query" />

  <PARAM NAME="Param.1" VALUE="param1_value" />

  <PARAM NAME="Param.2" VALUE="param2_value" />

  <PARAM NAME="Param.3" VALUE="param3_value" />

</APPLET>

former_member185280
Active Contributor
0 Kudos

Try using the applets 'CreationEvent'

Applet Events - SAP Manufacturing Integration and Intelligence - SAP Library

Without that there is no guarantee that your script will execute after your applet is ready.

former_member185280
Active Contributor
0 Kudos

Also I wonder if your height and width are causing an issue. Try WIDTH="1" HEIGHT="1"

0 Kudos

unfortunately changing "width" and "height" didn't help...

But how to use that CreationEvent? From the page you have provided is not clear to me how to use it...

Thanks

swaroop_anasane
Active Contributor
0 Kudos

Hi Tibor,

Nothing to do with Height and Width.

Also, can you let me know where exactly have you put above code that is generating error.

This would help me suggest a better way.

About creation event, please find the same below:

<APPLET name="SomeApplet" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="0px" HEIGHT="0px" MAYSCRIPT="mayscript">

  <PARAM NAME = "QueryTemplate" VALUE="some_valid_path_to_Xacute_query" />

  <PARAM NAME="Param.1" VALUE="param1_value" />

  <PARAM NAME="Param.2" VALUE="param2_value" />

  <PARAM NAME="Param.3" VALUE="param3_value" />

     <PARAM NAME="CreationEvent" VALUE="FUNCTIONTO CALL" />

</APPLET>


Where FUNCTIONTOCALL is the function that contains var someObject = document.SomeApplet.getQueryObject();


Hope this helps.



Best Regards,

Swaroop

0 Kudos

Hi Swaroop,

the getQueryObject() call is in the JQuery document.ready() function:

$( document ).ready(function() {...});

How to use the CreationEvent in this case?

Thanks

swaroop_anasane
Active Contributor
0 Kudos

Hi Tibor,

Applet loads independent of page. Your document may be ready but the applet may not, that is the reason it's not recommended to use page lifecyle events with applet instead you have separate lifecyle events for applets.

You can copy CreationEvent param from above shared example and place it in your applet code. This would automatically call your function with the applet has loaded completely.

Thanks,

Swaroop

0 Kudos

thanks, now it is clear

but what should I use for FUNCTIONTOCALL?

and 1 additional question. If I have applets in the following order in my .irpt file:

<Applet1/>

<Applet2/>

<Applet3/>


and I know, that <Applet3/> is ready. This implies that also <Applet1/> and <Applet2/> are ready?


Thx


former_member185280
Active Contributor
0 Kudos

Wow this takes me back....

You can do something like this for your param:

<PARAM NAME="CreationEvent" VALUE="appletReady" />


Then define your function like this:


function appletReady(){

     //start doing stuff


}


If you have multiple applets, say 3, I think you can do something like this:


var readyCnt = 0;


function appletReady(){


     readyCnt++;

     if(readyCnt===3){

     //start doing stuff

     }


}


Overall I would recommend avoiding all applet usage if possible tho. They just create too many headaches.

swaroop_anasane
Active Contributor
0 Kudos

Hi Tibor,

Christian Just answerd how you can use the function call.

Ans for your question, NO there is no interrelation between applets loading, applet 3 can load before applet 1 sometimes as vice-versa. Keep a flag, and chain it if it's a must to check if applet has loaded completely.

Thanks,

Swaroop

0 Kudos

thank you very much to both of you that was the problem, now I am able to eliminate the error message in Chrome with the code snippet provided by Christian

Sure, the best would be to remove all the applets...

Answers (0)