cancel
Showing results for 
Search instead for 
Did you mean: 

setting Tag Name at runtime

Former Member
0 Kudos

Hi,

Can i set the tag names at run time through Java script?

i mean can we do something like

<u><b>script in myIRPT</b></u>

for(i =1; i<=count; i++)

{

TagName <i> = document.TagDetails.getPropertyValue("TagName"+i);

document.Mychart.getQueryObject().setTagName(i,TagName<i>);

}

Value for <b>count</b> is document.TagApplet.getBrowserObject().getSelectedItemCount() which i am getting from a HTML page

The above script is not working... I am getting those values in array(TagName... this also i am getting from HTML), but i am unable to set names for TAG.

to make my doubt little more clear, can i replace

<PARAM NAME="TagName.1" VALUE="{----}" > with some script ?

regards

Muzammil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What seems to be the issue -

1. setting the Tag Name for the Query OR

2. getting the property value in ur irpt?

Former Member
0 Kudos

hi Udayan and Rick,

I am getting the values from Webpage to that IRPT page. And till that it is working fine. But i need to knw is there any way that i can set the tagnames through the given Javascript

Well, I will try to explain you an overview of what i am planning to do.

Getting the tagnames and chart types from an HTML page, passing that into an IRPT and displaying the chart accordingly. So everytime the chart type and Tagnames can be different. The problem which i am having now is, the first time whn i select 6 tags to display the chart (say for eg:- Cyltemp1,Cyltemp2,Cyltemp3, fan1,fan2 and Fan3 respectively ) and the second time i need to take only 3 tags (say AssetUtil1,AssetUtil2,AssetUtil3) it is still showing 6 tags in my IRPT as (AssetUtil1,AssetUtil2,AssetUtil3, fan1, fan2,fan3) . means the last three tags is not getting cleared. Before i was using <param name="Tagname.1" value="{}">. .....<param name="Tagname.n" value="{}">

Thats why i thought of having it done with help of javascript.

Please help me out.

Regards

Muzammil P.T

Former Member
0 Kudos

Seems to me a "cache not cleared" type of an issue.

Try using the following meta tags in ur HTML. Not sure if it'll really work but worth a try

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

<META HTTP-EQUIV="EXPIRES" CONTENT="-1">

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

put this in between <head></head>

If this doesn't work then repeat

<HEAD>

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

</HEAD>

after </body>

Make sure you are IE 6 (not lesser)

Former Member
0 Kudos

Hi Udayan,

Thanks for your reply. But it is not working

Regards

Muzammil

Former Member
0 Kudos

Does your page/application works in the following scenarios-

1. First time you select six tags and a chart type - you submit your page - look @ the desired result and close the browser. You re-log in and select 3 tags. Does it still show six as in the 3 you newly selected plus the 3 from the previous request?

2. First time you select six tags and a chart type - you submit your page - look @ the desired result . Clear the Java Cache manually and refresh the page. Next you select 3 tags. Does it work?

Former Member
0 Kudos

Hi,

Thanks for your reply.

Scenario :1 Answer :- I checked my Tags (6 tags)and i closed my browser, Once i relogin again and checked for 3 new tags, it showing only those 3 tags. No previous request has been shown

Scenario: 2 Answer :- I checked my Tags (6 tags) , cleared my java cache (Tools --> Sun Java console )and checked for new 3 tags. It is showing newly selected 3 tags plus previously selected tags too (3New + 3Old).

Regards

Muzammil P.T

Former Member
0 Kudos

Interesting!

I am running out of ideas now.

Let me ask you something - The structure of your application as I understand is like -

An HTML page where user can select the tag(s) plus the chart type . Submits it to an irpt to view the chart.

Then comes back to the main page by either - pressing the browsers back button or a different button on the irpt page.

Is this correct?

Former Member
0 Kudos

Hi Udayan,

well, there is a slight change. I am maintaining an HTML Page with an IFRAME inside which contains the required IRPT Page. So there is nothing like coming back to the main HTML Page. I am not pressing browser back button to come back or maintaining any button for the same in irpt page.

Regards

Muzammil

0 Kudos

Hi Muzammil,

Here is how you can dynamically change a chart with different tags.

1. Create a tag query template without any tag selected. Just configure the data source and date range(if required).

2. Create a blank iChart display template i.e. do not select any value in the data mappling.

This way there is no default tag name assigned to the above query or display templates.

3. Create an applet with combination of above query and display template. Obviously, you will not see anything on the chart because there is no data.

4. Using javascript you can set the tagnames for the query in runtime by using following script:

document.<applet_name>.getQueryObject().setTagName(index,name).

eg. document.Tag_Chart.getQueryObject().setTagName(1,"AssetUtil1");

I hope this helps.

regards

Deepak

Former Member
0 Kudos

Hi Deepak,

Its working. Thanks a lot.

In Runtime , i am setting the TAG as

for(i =1, j=0; i<=count; i+,j+)

{

TagName[j] = document.TagDetails.getPropertyValue("TagName"+j);

document.Mychart.getQueryObject().setTagName(i,TagName[j]);

}

and calling this method onLoad on Body Tag.

Thanks a lot

Regards

Muzammil

erik_schrampf
Active Participant
0 Kudos

Muzammil,

It is not a good practice to use the onload method call in the body tag with applets. The reason is when applets load they load erratically. This being said if you use a body onload call your applet may not have loaded yet and therefore you function will not run. A better solution is to use and applet event such as

<PARAM Name="CreationEvent" Value="FunctionName" >, this way your function will always be called during the creation of you applet.

Regards,

Erik

Former Member
0 Kudos

Thanks Erik

Regards

Muzammil

Answers (1)

Answers (1)

Former Member
0 Kudos

1. Are you certain the correct values are assign in session/property variables?

2. Don't forget to call document.Mychart.updateChart(true) after setting the tags.