Focal Point
[CLOSED] Javascript parameter

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1707027096

August 28, 2018, 12:26 PM
KellyT
[CLOSED] Javascript parameter
Hello,
I have an outside application that I'm calling my URL (dashboard). I want to pass in my initials within the URL.

From there I want my html file to read my passed in initials and populate my reports.

I'm having an issue of the fex/html file reading my passed in initials parameter.

my fex file:

 TABLE FILE MDGETMETRICSDASHBOARDGROUPDEV
BY  LOWEST MDGETMETRICSDASHBOARDGROUPDEV.ANSWERSET1.GROUPORDER NOPRINT
BY  LOWEST MDGETMETRICSDASHBOARDGROUPDEV.ANSWERSET1.FLEETID
WHERE ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@INITIALS EQ '&X' ) AND ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@DEFAULTDASH EQ 'fleet' );
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENblue_theme.sty,
$
ENDSTYLE
END 



my embedded javascript code in my html file: --currently i have my initials KJT hard coded but I need to get the passed in initials instead.

 if(typeof(bRuntime) != 'undefined') {
// TODO: Add your inline runtime code here
}
//Begin function window_onload
function window_onload(){
UpdateData();

//document.getElementById('edit1').value = "!IBI.AMP.FOCSECUSER;";
document.getElementById('edit1').value = "KJT";
document.getElementById('button1').click();
document.getElementById('edit1').style.display = "none";
document.getElementById('report1').style.display = "none";
document.getElementById('button1').style.display = "none";
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload

function refreshReports(){
var name = this.window.name;
  parent.BipIframeInterface.setAllAmpersValues(name, IbComposer_getAllAmpersValues());
  parent.BipIframeInterface.refresh(parent.BipIframeInterface.REFRESH_ALL_BUT_SELF , name); 


my url:

...FleetDashboard?INITIALS=KJT

This message has been edited. Last edited by: FP Mod Chuck,


Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
August 28, 2018, 01:15 PM
vinodh
did you try to populate the initial's to a text box in the dashboard/html rather passing it to the fex directly which is inside the html.


WebFOCUS 8
Windows, All Outputs
August 28, 2018, 01:21 PM
KellyT
no.

how do I pass the initials from my url call directly to the dashboard?

i tried:
function window_onload(initials)(){
updatedata();
document.getElementsById('edit1').value = initials;  


but that didn't work either.


Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
August 29, 2018, 03:54 AM
Wep5622
Since you're already using an amper-variable in your HTML, logic dictates that your other parameters are available by the same means.

You should be able to read your initials from !IBI.AMP.INITIALS;

Another approach would be to dissect the query parameter from the window.location object. See: https://developer.mozilla.org/.../API/Window/location


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 29, 2018, 10:16 AM
Hallway
quote:
 WHERE ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@INITIALS EQ '&X' ) AND ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@DEFAULTDASH EQ 'fleet' );

my url:

...FleetDashboard?INITIALS=KJT


Your amper var should be the same that is inthe URL:

  
WHERE ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@INITIALS EQ '&INITIALS' ) AND ( MDGETMETRICSDASHBOARDGROUPDEV.INPUT.@DEFAULTDASH EQ 'fleet' );



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
August 30, 2018, 12:28 PM
KellyT
Hello<
The !IBI.AMP.INITIALS didn't work.
Here is what I had for the code:
document.getElementById('edit1').value = "!IBI.AMP.INITIALS;";

I wanted to just put it in the edit box so i could see the value that was getting passed in.
All that would display for me was !IBI.AMP.INITIALS in the text

2) I tried the window.loction.href. However, I'm calling a dashboard URL and the window.location.href is using the location of my html page.

So example the url to my dashboard: 'http://dre/ibi_apps/bip/portal/FleetDashboard?INITIALS=KJT'

But in my html page in the edit box it is displaying the actual location of html file.
http://dre/ibi_apps/run.bip?BI...00000&BIP_rand=76048

This message has been edited. Last edited by: KellyT,


Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
September 03, 2018, 03:50 AM
Wep5622
I don't suppose using document.location behaves any different?

Judging from the missing amper-variable and that edit box your URL is in, it looks like the portal may be combined into one page server-side. If that's true, then the solution depends on whether IBI decided to pass any information in those URL's on to the resulting portal page.

I'm not familiar with the portal, can't help you there...


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :