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] Parse URL variables for use in Dialogue Manager

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Parse URL variables for use in Dialogue Manager
 Login/Join
 
Silver Member
posted
I get the following URL when I click a link from an HTML page to run my report:

http://mywebfocus.mycompany.com/ibi_apps/WFServlet?&IBIC_server=SRV1&IBIF_ex=proddir/statrpt&VAR1=LOKEY-8L893U&USERID=MDRUMMOND&MYEMAIL=Marcia.Drummond@gmail.com

When I enter the 3 parameters required by my launch page, I would also like to have the values for &USERID and &MYEMAIL passed to my procedure.

I've already searched the forums looking for ways to do this, but was unable to find a solution to do just this.

Please help. Sweating

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
Platinum Member
posted Hide Post
MarciaDrummond,
Not sure what you are asking? Do you mean the 3 parameters need to be passed to another report or does the other report open in your launch page? If it is a drill down to the report you should be able to capture the &VARS and pass to the next report.
 COMPUTE URLSTART/A120 = 'http://mywebfocus.mycompany.com/ibi_apps/WFServlet?&IBIC_server=SRV1&IBIF_ex=proddir/statrpt&VAR1=LOKEY-8L893U';
COMPUTE URLFINISH/A120 = URLSTART || &USERID.EVAL || &MYEMAIL.EVAL;


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
 
Posts: 130 | Location: Columbus, Ohio | Registered: February 25, 2009Report This Post
Expert
posted Hide Post
ERINP is close:
 
COMPUTE URLSTART/A120 = 'http://mywebfocus.mycompany.com/ibi_apps/WFServlet?&IBIC_server=SRV1&IBIF_ex=proddir/statrpt&VAR1=LOKEY-8L893U';
COMPUTE URLFINISH/A250 = URLSTART || '&' || 'USERID='|| '&USERID.EVAL' || '&' || 'MYEMAIL=' || '&MYEMAIL.EVAL';
 


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
Let me clarify, I need to get the aforementioned variables from the URL line. I am guessing that there is some sort of JavaScript that can query the URL line to do this, but I have not been able to find it.

The launch page contains 3 parameters (1 text box and 2 calendar controls); a Submit button and an iframe. Once the user has entered the location number and chosen the date range, they click Submit and the report populates the iframe. Additionally, I need to capture the user ID and their email address which is available in the URL line.


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
Expert
posted Hide Post
If it is available in the URL, then, it is available in the report as &USERID and &MYEMAIL.
In the statrpt fex, at the very top, do:
  
-? &
-EXIT

All the ampere variables available will be displayed, including the above...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
Unfortunately, those 2 variables are not listed when the amper variables are queried. They may be available to the html page and I would like to use some sort of scripting to parse the URL into its individual components so that I can get the values of the user ID and email address.

I envision a parsing of the URL line and selection of the 2 variables placed into individual hidden components on the page. When the user clicks Submit, all 5 variables will be passed to the focexec (location number, start date, end date, user ID, and email address)- I just do not know how to do it. Confused


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
Expert
posted Hide Post
Is &VAR1 available? How can that ampere variable be available and the others aren't???

That is what the URL does, passes ampere variable's into the called focexec, and, they are then used for whatever.

Something is missing...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
&VAR1 is not available either.

The launch page was not deployed by me. I used the Composer to create the launch page and created a one-line fex to call the HTML page using -HTMLFORM. I gave the name of the focexec to the owners of the web site and they made it available via a link on their website.

My understanding is that the site is using Lotus Notes and the variables VAR1, USERID and MYEMAIL are coming from Notes. That being said, I now have an HTML page with those values in the URL and I would like to make them available to my procedure.


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
Member
posted Hide Post
quote:
http://mywebfocus.mycompany.com/ibi_apps/WFServlet?&IBIC_server=SRV1&IBIF_ex=proddir/statrpt&VAR1=LOKEY-8L893U&USERID=MDRUMMOND&MYEMAIL=Marcia.Drummond@gmail.com


If you enter this URL in browser-
1. It should invoke "statrpt" procedure from "proddir" application.
2. It should pass values for "VAR1","USERID" and "MYEMAIL" variable to startrpt procedure.

This means that, above variables are automatically available in your procedure.

To test-
Put following lines at the begining of "statrpt" procedure.
-SET &ECHO=ALL;
-? &
-EXIT

Then copy and paste the above url in browser address bar.
Post the output.


7.6.9/7.7
Windows/OS 390
HTML
 
Posts: 11 | Location: Pune | Registered: March 08, 2011Report This Post
Expert
posted Hide Post
Marcia,

You are not executing things in the proprer sequence, my guess.

1) Do what I said earlier, at the very top of the statrpt fex, add:

-? &
-EXIT

SAVE THE FOCEXEC.

2) Execute the HTML Launch page and select the Location number and date range.

CLICK ON SUBMIT

3) All the & variables will be displayed. These will be available to you in the report.

4) Go back to statrpt fex and delete the 2 lines added in 1)...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
I think there is a miscommunication here so I will re-state what is going on.

When, as suggested, I do the query of the local amper variables available to my procedure using the -? & those variables are NOT available to the procedure. The variables that I want to capture are being passed to the URL string from Lotus Notes which was used to develop the hyperlinks on the user's home screen. The Lotus Notes programmers are sending the values for &VAR1, &USERID and &MYEMAIL from Lotus Notes to any procedure executed from the hyperlink on the home screen. They are visible in the URL and all I need is an example of some JavaScript that can parse the URL string.

What I am looking for can be done with PHP with something like:

$myQryStr = "first=1&second=Z&third[]=5000&third[]=6000";
parse_str($myQryStr);
echo $first; //will output 1
echo $second; //will output Z
echo $third[0]; //will output 5000
echo $third[1]; //will output 6000
?>

for this url

We did not want to take that route.

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
Expert
posted Hide Post
When did this forum turn into a Javascript forum?
Search GOOGLE, parse url javascript, only about 2.8M results...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
Thank you very much, Tom.

You have been very helpful. Eeker

JavaScript was only mentioned as my best guess at how to do this.

Just as an FYI, I have done some searching both online and in this forum. I decided to post here since the solution has to be an IB solution for the most part.

I am not a novice developer by any means and really did not appreciate that response, but it's out there and I will choose to let it pass.

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
<FreSte>
posted
Marcia,

After reading all the posts in this thread, I understand that Lotus Notes is NOT creating this complete url

h ttp://mywebfocus.mycompany.com/ibi_apps/WFServlet?&IBIC_server=SRV1&IBIF_ex=proddir/statrpt
&VAR1=LOKEY-8L893U&USERID=MDRUMMOND&MYEMAIL=Marcia.Drummond@gmail.com


but for instance

h ttp://mywebfocus.mycompany.com/alias/launchpage.htm&VAR1=LOKEY-8L893U&USERID=MDRUMMOND&MYEMAIL=Marcia.Drummond@gmail.com


and you need to get capture those 3 variables in your launchpage.htm

If the above is not true, stop reading otherwise you could do something like this in your launchpage.htm :
(no error-handling is programmed, but just to get an ieda how it could be done)
(you can change type="text" to type="hidden" to hide these values)

<html>

<script>
function getVariables() {
    var _tempArray = document.location.search.split("&");
    for (var i=0; i < _tempArray.length; i++) {
                if (_tempArray[i].toUpperCase().indexOf("VAR1=")    > -1 ||
                    _tempArray[i].toUpperCase().indexOf("USERID=")  > -1 ||
                    _tempArray[i].toUpperCase().indexOf("MYEMAIL=") > -1 ) {

                  var _id    = _tempArray[i].toUpperCase().split("=")[0];
                  var _value = _tempArray[i].split("=")[1];
                  document.getElementById(_id).value = _value;
                }
    }
}
</script>

<body onload="getVariables();">

<form action=bladiebla ... target="your_iframe" >

<input type="text" id="VAR1"     name="VAR1"     value="FOC_NONE">
<input type="text" id="USERID"   name="USERID"   value="FOC_NONE">
<input type="text" id="MYEMAIL"  name="MYEMAIL"  value="FOC_NONE">
<br><br>
[i]Your variables here ...[/i]
<br><br>
<input type="submit">

</form>

</body>
</html>

This message has been edited. Last edited by: <FreSte>,
 
Report This Post
Silver Member
posted Hide Post
Hi Fred,

You are correct that Lotus Notes is not creating the entire URL. The Lotus Notes group has just exposed/made available those 3 variables and their values which get appended to the end our standard WebFOCUS call string as shown.

That being said, will the document.location.search.split("&") used to create the _tempArray variable also pick up the &IBIC_server=SRV1 and the &IBIF_ex=proddir/statrpt? If so, that is not an issue since I can add 2 more elements to the array and just not use them - I think. This method is new to me.


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
<FreSte>
posted
Yes, all &-variables will be picked up in the example above. If more variables are being added by the Lotus Group, that's no problem.
The IF_THEN construction skips all &-variables which are not VAR1, USERID or MYEMAIL.
 
Report This Post
Silver Member
posted Hide Post
Perfect!

I will apply this script to my page and let you know how it works (and I anticipate that it should).

I will get back to this post with my results.

Thanks again, Fred, for your prompt responses! Smiler


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report This Post
<FreSte>
posted
Marcia,

After giving this a second thought, there is a more elegant way to do it.
If you want to capture some variables from the searchstring, just add an object (in this case INPUT TYPE="text") with the id to your
FORM and use this function instead:

function getVariables() {
  var _tempArray = document.location.search.split("&");
  for (var i=0; i < _tempArray.length; i++) {
    var _id    = _tempArray[i].toUpperCase().split("=")[0];
    var _value = _tempArray[i].split("=")[1];
    if (document.getElementById(_id) ) {
      document.getElementById(_id).value = _value;
    }
  }
}


What is does is it checks if the DOM has an object with the same id as the name of the variable (e.g. &VAR1).
If it does, the object is (in this example) filled with the value of that variable. If it's not found, nothing happens.

-Fred-
 
Report This Post
Silver Member
posted Hide Post
Perfect solution, FreSte!!! Smiler

In the interest of time, I wanted to keep the web page 'as is', so to use your JavaScript:

1. Copied your code into the Composer-generated "script area" surrounded by <script> tags.

2. I added 2 variables to the "variables" section of the HTML code by doing a copy/paste of one of the existing variables on the page. Did the appropriate renames for displayfield, field, desc, etc.

3. Most importantly, I called your JavaScript function as the value for the default value in each variable.

It worked like a charm and I am most thankful for your assistance. Cool


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
 
Posts: 32 | Registered: October 01, 2010Report 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] Parse URL variables for use in Dialogue Manager

Copyright © 1996-2020 Information Builders