Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Can i give a parameter a value with javascript
Go
New
Search
Notify
Tools
Reply
  
Can i give a parameter a value with javascript
 Login/Join
 
Platinum Member
posted
Hello,

I have a problem and I hope that you can help me.

This is the problem:

I want to give a value to a parameter with javascript. I read a querystring giving by a drilldown.
The parameters are important namely :
(&IBIAPP_app=) &APPNAM
(&IBIF_ex=) FEXNAM
and &VARNAM, this 3rd one is not filled with the drilldown parameter (&SELCAR=????).

First I got a fex named CHKCAR with a drilldown to Metarefresh1.fex reads the querystring and then run CHKCAR2.fex with parameter &SELCAR.

Metarefresh1.fex fills &APPNAM and &FEXNAM correctly but &VARNAM is not filled correct.

Does someone has a answer?

The used fexen are:

*---- CHKCAR.fex

-* File chkcar.fex
-DEFAULT &APPNAM='Test'
-DEFAULT &FEXNAM='CHKCAR2'
-*-DEFAULT &SELCAR='BMW';
TABLE FILE CAR
PRINT
MODEL
BODYTYPE
SEATS
BY CAR
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
TYPE=DATA,
COLUMN=N1,
FOCEXEC=metarefresh1(APPNAM='&APPNAM' FEXNAM='&FEXNAM' SELCAR=N1),
$
ENDSTYLE
END



*---- CHKCAR2.fex


-* File chkcar2.fex
-DEFAULT &SELCAR='BMW';
TABLE FILE CAR
PRINT
MODEL
BODYTYPE
SEATS
BY CAR
WHERE CAR EQ '&SELCAR';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
ENDSTYLE
END



*---- Metarefresh1.fex



-* Tonen wachtscherm.
-* Verwerken rapport adhv een variable.

-DEFAULT &URLA='http://s9051160/cgi-bin/ibi_cgi/ibiweb.exe?IBIC_server=WFSPROD&IBIAPP_app=' ;
-DEFAULT &URLB='&IBIF_ex=';
-DEFAULT &URLC='&IBIWF_messages=10&IBI_random=6005';
-DEFAULT &APPNAM='';
-DEFAULT &FEXNAM='';
-DEFAULT &VARNAM='';
-*-DEFAULT &APPNAM='test';
-*-DEFAULT &FEXNAM='chkcar2';
-*-DEFAULT &VARNAM='&SELCAR=AUDI';

-HTMLFORM BEGIN


CONTENT="0;
URL=&URLA|&APPNAM|&URLB|&FEXNAM|&URLC|&VARNAM ;">
Please wait...



<script type="text/javascript">
-* Begin Querystring

var IEpt = new Array(0,10,12,16,18,24,32,48);
var qs = new Querystring();
var totstring = '';


function Querystring(qs) { // optionally pass a querystring to parse
this.params = new Object()
this.get=Querystring_get

if (qs == null)
qs=location.search.substring(1,location.search.length);

if (qs.length == 0)
return;

qs = qs.replace(/\+/g, ' ');
var args = qs.split('&'); // parse out name/value pairs separated via & ??

var webvar;
var webvartot;

// split out each name=value pair
for (var i=0;i var value;
var pair = args[i].split('=')
var name = unescape(pair[0])

if (pair.length == 2)
value = unescape(pair[1])
else
value = name

this.params[name] = value
if (name == 'APPNAM') {
alert("appnaam : " + value);
&APPNAM = value;
}
if (name == 'FEXNAM') {
alert("fexnaam : " + value);
&FEXNAM = value;
webvartot = ' ';
}

if (i>6) {
alert("name : " + name + " value : " + value + " i : " + i);
webvar = "&" + name + "=" + value;
webvartot += webvar;
}
// else if (i<5) {
// webvartot = ' ';
// }
}
alert("end webvartot : " + webvartot);
&VARNAM = webvartot;

}

function Querystring_get(key, default_) {
// This silly looking line changes UNDEFINED to NULL
if (default_ == null) default_ = null;

var value=this.params[key]

alert("params : " + value);

if (value==null) value=default_;

return value
}


-* End Querystring

<script>

// Variables you may modify --------------------------------
var fexnaam;
var BackgroundColor1 = '#006942';
var BackgroundColor2 = '#ffffcc';
var Speed = 1;
var PleaseWaitMsgText = 'Please wait for report';

// Array of Microsoft DXImageTransform Transitions ---------
var garTransitions = new Array(01);
garTransitions[0] = "progidBig GrinXImageTransform.Microsoft.RadialWipe(wipeStyle='clock')";

var giDuration = Speed;
function init() {
div1.style.filter = garTransitions[div1.filterCount];
setTimeout("start()", 100);
}


function start() {
obj = div1;
if (obj.filters.item(0).status==0)
{
obj.style.filter = garTransitions[obj.filterCount];

if (obj.filterCount== (garTransitions.length - 1))
obj.filterCount = 0;
else
obj.filterCount = (obj.filterCount)*1 + 1.0;

obj.filters.item(0).Apply();
if (obj.innerText == PleaseWaitMsgText) {
obj.style.backgroundColor = BackgroundColor2;
obj.innerText = PleaseWaitMsgText + ' ';
}
else {
obj.innerText = PleaseWaitMsgText;
obj.style.backgroundColor = BackgroundColor1;
}
obj.filters.item(0).Play(duration=giDuration);
}
}
function done(i) {
start(i);
}







<script language="JavaScript">document.write(PleaseWaitMsgText);












-HTMLFORM END
 
Posts: 103 | Registered: March 18, 2008Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I'm not a javascript guru, so I can't tell exactly what it is you are trying to accomplish with all the javascript. I get the "please wait" - maybe that is the whole purpose of your javascript part - but it seems like you are also trying to construct another URL to execute instead of just letting drilldowns work as they are designed to. Just specify car2.fex in the FOCEXEC= with SELCAR=N1. No need for all the rest of the parms or the javascript. Am I oversimplifying?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Some reports take a lot of time before they show the results, therefor I use the metarefresh1.fex as a waiting time indicator.
Yes this fex takes over the drilldown action so the report will show over the 'please wait' message.
 
Posts: 103 | Registered: March 18, 2008Reply With QuoteReport This Post
Virtuoso
posted Hide Post
This case may be of some help.

It doesn't relate to your problem directly but mentions a couple of techniques that may solve your problem - specifically the !IBI.AMP.&variable


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
MrM,

Can you provide any more information regarding your javascript, the one used to display the "PleaseWaitMsgText" message. I'm not a JavScript guy to the extent that I would know how to incorporate that javascript into an existing launch page whcih was created via the HTML Layout Painter.

I thank you in advance for your much appreciated insight and sharing your knowlege.
-Doug




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3106 | Location: Tennessee, Nashville area | Registered: February 23, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I am not sure what you are trying to achieve here. It seems that you are saying you cannot pick up &SELCAR. However you cannot set &variables in the way you want as they have been evaluated prior to the js being run, but if that is the case, a simple version of metafresh1.fex would be:
-DEFAULT &URLA='http://localhost/ibi_apps/WFServlet?IBIC_server=EDASERVE&IBIAPP_app=' ;
-DEFAULT &URLB='&IBIF_ex=';
-DEFAULT &URLC='&IBIWF_messages=10&IBI_random=6005';
-DEFAULT &APPNAM='';
-DEFAULT &FEXNAM='';
-DEFAULT &VARNAM='&SELCAR=';

-HTMLFORM BEGIN
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=!IBI.AMP.URLA;!IBI.AMP.APPNAM;!IBI.AMP.URLB;!IBI.AMP.FEXNAM;!IBI.AMP.URLC;!IBI.AMP.VARNAM;!IBI.AMP.SELCAR;">
<title>Please wait...</title>

<style type="text/css">
body
  { font-family: Arial, sans-serif; font-size: 12px; font-weight: normal; margin: 0px; }

.MsgText
  { font-size: 14px; font-weight: bold; color: black;
    position: relative; top:100; width: 250px; padding: 10px; }
</style>
<script>

var BackgroundColor1 = '#006942';
var BackgroundColor2 = '#ffffcc';
var Speed = 1;
var PleaseWaitMsgText = 'Please wait for report';

// Array of Microsoft DXImageTransform Transitions ---------
var garTransitions = new Array(01);
garTransitions[0] = "progid:DXImageTransform.Microsoft.RadialWipe(wipeStyle='clock')";

var giDuration = Speed;
function init() {
    div1.style.filter = garTransitions[div1.filterCount];
    setTimeout("start()", 100);
}

function start() {
  obj = div1;
  if (obj.filters.item(0).status==0)
  {
    obj.style.filter = garTransitions[obj.filterCount];

  if (obj.filterCount== (garTransitions.length - 1))
    obj.filterCount = 0;
  else
    obj.filterCount = (obj.filterCount)*1 + 1.0;

  obj.filters.item(0).Apply();
  if (obj.innerText == PleaseWaitMsgText) {
    obj.style.backgroundColor = BackgroundColor2;
    obj.innerText = PleaseWaitMsgText + ' ';
  }
  else  {
    obj.innerText = PleaseWaitMsgText;
    obj.style.backgroundColor = BackgroundColor1;
  }
  obj.filters.item(0).Play(duration=giDuration);
    }
}
function done(i) {
  start(i);
}
</script>
</head>

<body onload="init();">
<center>

<div id="div1" class= "MsgText" filterCount=0 onfilterchange=done(1)>
  <script language="JavaScript">document.write(PleaseWaitMsgText);</script>
</div>

</center>
<div>
<table border="0" width="100%" id="table1">
<tr height=1000%>
    <td></td>
 </tr>
</table>
</div>
</body>
</html>
-HTMLFORM END


To check this, add a
SLEEP 10
-RUN
at the beginning of chkcar2.

This would work for the basics, is there something else you need this to do.

(REMOVED ERRONEOUS SEMI COLON.)

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Alan

In this case you can use this solution because there is just one variable. But i want to make it flexibel so that fex (read drilldown) with a lot variables also work. See : http://s9051160/ibi_apps/WFServlet?IBIF_webapp=/ibi_app...DE=%20&MNDNSWI=ALLES

The parameter starts from &JARMND.

Regards,

Mark
 
Posts: 103 | Registered: March 18, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Doug

Every drilldown works with a javascript querystring this is everyting in a URL after ?
So when Metarefresh1.fex runs it import the qeurystring and split it in 'name' and 'value'.
The first two are importen for starting de drilldown fex and the rest are variables.

quote:
Originally posted by Doug:
MrM,

Can you provide any more information regarding your javascript, the one used to display the "PleaseWaitMsgText" message. I'm not a JavScript guy to the extent that I would know how to incorporate that javascript into an existing launch page whcih was created via the HTML Layout Painter.

I thank you in advance for your much appreciated insight and sharing your knowlege.
-Doug
 
Posts: 103 | Registered: March 18, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
Mark,
Thanks for the additional insight you provided in your March 21, 2008 06:23 AM post. I'll work with this as see how it goes.
-Doug




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3106 | Location: Tennessee, Nashville area | Registered: February 23, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
This code will replace the value of IBIF_ex with the value from FEXNAM, which would seem to be the only part in the string that needs to be replaces. If you want more then this code can give the base for obtaining string/value pairs.

-HTMLFORM BEGIN
<html>
<head>
<title>Please wait...</title>

<style type="text/css">
body
  { font-family: Arial, sans-serif; font-size: 12px; font-weight: normal; margin: 0px; }

.MsgText
  { font-size: 14px; font-weight: bold; color: black;
    position: relative; top:100; width: 250px; padding: 10px; }
</style>
<script>

var BackgroundColor1 = '#006942';
var BackgroundColor2 = '#ffffcc';
var Speed = 1;
var PleaseWaitMsgText = 'Please wait for report';

// Array of Microsoft DXImageTransform Transitions ---------
var garTransitions = new Array(01);
garTransitions[0] = "progid:DXImageTransform.Microsoft.RadialWipe(wipeStyle='clock')";

var giDuration = Speed;
function init() {
    div1.style.filter = garTransitions[div1.filterCount];
    setTimeout("start()", 100);
    runIt();
}

function start() {
  obj = div1;
  if (obj.filters.item(0).status==0)
  {
    obj.style.filter = garTransitions[obj.filterCount];

  if (obj.filterCount== (garTransitions.length - 1))
    obj.filterCount = 0;
  else
    obj.filterCount = (obj.filterCount)*1 + 1.0;

  obj.filters.item(0).Apply();
  if (obj.innerText == PleaseWaitMsgText) {
    obj.style.backgroundColor = BackgroundColor2;
    obj.innerText = PleaseWaitMsgText + ' ';
  }
  else  {
    obj.innerText = PleaseWaitMsgText;
    obj.style.backgroundColor = BackgroundColor1;
  }
  obj.filters.item(0).Play(duration=giDuration);
    }
}
function done(i) {
  start(i);
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if ( 
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}

function runIt(){
var a = getURLParam("FEXNAM");
var b = getURLParam("IBIF_ex");
var c = window.location.href;
var d = c.replace(b,a);
location.href=d;
}
window.onload = init;
</script>
</head>

<body>
<center>

<div id="div1" class= "MsgText" filterCount=0 onfilterchange=done(1)>
  <script language="JavaScript">document.write(PleaseWaitMsgText);</script>
</div>

</center>
<div>
<table border="0" width="100%" id="table1">
<tr height=1000%>
    <td></td>
 </tr>
</table>
</div>
</body>
</html>
-HTMLFORM END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Alan

Thanks for you answer i will try this out.


Mark
 
Posts: 103 | Registered: March 18, 2008Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Can i give a parameter a value with javascript

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.