cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables into Applet

Former Member
0 Kudos

Hi,

I have an applet on a web page in which I want to pass a date to it against one of the parameters. However, when I run the web page it appears that the date variable that I pass to the applet is not recognised.

How can I define a variable in a javascript and use this on an applet.

Thanks

Martin

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Martin,

Just a thought - you may want to try using the CreationEvent in the applet. This event triggers a JavaScript function when the applet is first loaded into the web page; the accompanying JavaScript function is called before the query runs.

Kind Regards,

Diana Hoppe

Former Member
0 Kudos

With a bit of jiggery pokery and all of the input from everyone finally got it working.

Former Member
0 Kudos

HI Martin,

If you are passing SD and ED (start and end dates) to applet.

You can define date format in query template.

If you are passing it to query. you can handle it in query.

Former Member
0 Kudos

Hi,

I have this at the moment .

<PARAM NAME="StartDate" VALUE="2011-01-01">

<PARAM NAME="EndDate" VALUE="2011-03-30">

This works fine. However, I need to calculate the date range that is to be specified. I am using a javascript function for this. However, the applet is being loaded before the javascript function runs.

Thanks

Martin

Former Member
0 Kudos

hi

Set initial update to false.


<PARAM NAME="InitialUpdate" VALUE="false">

and in Javascript set date and update the grid.


applet.getQueryObject().setStartDate(StartDate);
applet.getQueryObject().setEndDate(EndDate);
applet.updateGrid(true);

Edited by: Anshul Sahu on Jul 5, 2011 5:09 PM

Former Member
0 Kudos

Hi,

The problem I have is that the applet is not initialised at the time the javascript is called therefore the javascript fails to run.

I have been trying to use the following: -

<PARAM NAME="StartDate" VALUE="">

<PARAM NAME="EndDate" VALUE="">

However, it appears those parameters have no value when the applet is called. I have set an Alert on them and they are populated, but when passed to the applet they appear to be coming in as blank.

I have also tried this document.MaterialUsage.setPropertyValue("SQLDateTo",SQLDateTo); but again the applet is null at the time this runs.

Thanks

Martin

0 Kudos

Hi Martin,

Anshul has provided the mechanism for dealing with your applet/javascript timing mismatch.

Add the first section of code he provided to your applet.

Use the second section of code in your javascript. By setting the initial update to false, the applet does not execute the query/display template pair.

Then after you have updated the query with your date information, you set the update to true and it will then execute.

A second option:

If you want to pass in the date properties, you can add them to the url for the webpage (irpt page) using those names and session variables (enclosed in the braces) will provide those values to the applet prior to it running. Simply add the following code to your webpage url. I think you need to have single quotes around the dates, but tinker around with it to make sure.



&SQLFromTo=<somedate>&SQLDateTo=<someotherdate>


Regards,

Mike