Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Javascript - Get Parameter from this.window.name and Use it In Fex

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Javascript - Get Parameter from this.window.name and Use it In Fex
 Login/Join
 
Platinum Member
posted
Hello,

I'm trying to automatically get the "this.window.name" function to populate in a parameter in my fex. At the moment, all I am able to do is get this to work by calling the variable via onclick. My problem is separated into two items:

1. How do I get javascript to run onload within a .fex?
2. How do I pass the variable set in javascript back to an & variable that the .fex can read?

Here's the code I'm working with so far.

 TABLE FILE CAR
HEADING
"CLICK HERE"
PRINT CAR NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=HEADING,JAVASCRIPT=SAVEDAT(),$
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<html>
<script language="javascript">
function SAVEDAT()
{
var usrid=parent.MyHTMLParmsPage = this.window.name;

alert(usrid);
}
</script>
</html>
-HTMLFORM END 


Thanks in Advance!!

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


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Expert
posted Hide Post
There are so many ways to do this.

Simplest (not knowing what you are trying to do) would be to move the HTML to before the report and remove the function container, just run the js.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Hey Waz,

Thank you very much for your response. so if I just put this at the beginning of the report, it looks like nothing runs. Am I doing something wrong? Do I need to use a different function?

What function would I use to pass the var usrid to something WebFOCUS could read?

-HTMLFORM BEGIN
<html>
<script language="javascript">
function SAVEDAT()
{
var usrid=parent.MyHTMLParmsPage = this.window.name;

alert(usrid);
}
</script>
</html>
-HTMLFORM END 
 


Thanks in advance!


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Expert
posted Hide Post
Like this
-HTMLFORM BEGIN
<html>
<script language="javascript">
var usrid=parent.MyHTMLParmsPage = this.window.name;

alert(usrid);
</script>
</html>
-HTMLFORM END 


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Thank you Waz, didn’t see your point about removing the function earlier. How about reading the parameter in the .fex in WebFOCUS? Is there a function that needs to happen? I know there’s some html ibi.amp thing that you put in the code.

Is there a better way to read the current portal page other than this.window.name btw?

Thank you for your help.


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Expert
posted Hide Post
Here is where is get tricky.

There are possibly other ways to do it, but my suggestion for simplicity sake is to call your fex with the parameter from the HTML page, passing the name.

Something like this.

-HTMLFORM BEGIN
<html>
<script language="javascript">
window.location = '/ibi_apps//run.bip?BIP_REQUEST_TYPE=BIP_LAUNCH&|BIP_folder={IBFS Location}&|BIP_item={fexname}&|PAGENAME='+this.window.name ;
</script>
</html>
-HTMLFORM END 


The fex will get the window name in the variable &PAGENAME


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Wow Waz, thank you very much for your response here. I saw another post where you talked about this briefly and I knew you knew what to do here


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Platinum Member
posted Hide Post
I’ll try this out next week when I get back from vacation and hopefully can close this out. Appreciate it!!


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
Master
posted Hide Post
quote:
<script language="javascript">


For what it's worth, language="javascript" is not a valid attribute for a script element. The proper attribute is a JavaScript MIME type like this:
 <script type="text/javascript"> 


With that said, the HTML5 specification urges authors to omit the attribute rather than provide a redundant MIME type. So that means that all you need is <script> and you're good to go.


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Master
posted Hide Post
quote:
call your fex with the parameter from the HTML page, passing the name


Using Waz's suggestion, you could also use an iframe by passing the variable in the uri of the iframe src, and not have to redirect the html page
  
-HTMLFORM BEGIN NOEVAL
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #report1{
            width:100vw;
            height:100vh;
        }
    </style>
</head>
<body>
    <iframe src="" frameborder="0" id="report1"></iframe>
    <script>
        const path = `/ibi_apps/run/ibfs`;
        const ibfs_path = `IBFS:/WFC/Repository/domain/fileNmae.fex`;
        const usrid = parent.MyHTMLParmsPage = this.window.name;
        const uri = `${path}?IBFS_path=${ibfs_path}&usrid=${usrid}`
        document.querySelector('#report1').src = uri;
    </script>
</body>
</html>
-HTMLFORM END

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Platinum Member
posted Hide Post
I never got around to being able to try this. Thank you so much for responding and for all the help here! This is awesome!


WebFOCUS 8204
 
Posts: 152 | Registered: July 10, 2018Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Javascript - Get Parameter from this.window.name and Use it In Fex

Copyright © 1996-2020 Information Builders