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     Allow users to enter multiple values for a field in a launch page
Page 1 2 

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Allow users to enter multiple values for a field in a launch page
 Login/Join
 
Silver Member
posted
I have a requirement to allow users to enter (or ideally, paste) a list of values (10 or less) for a particular field, which will be used to filter a report. The values that the user would enter may or may not exist in the database, so I can't build a list for them to use to choose from the values--they need to enter them. Does anyone have a good method for accomplishing this? Users will be accessing an HTML page to launch their reports. Was trying to use the Text Area control--it lets me enter the text, but the report won't accept it as multiple rows of data. I could require the users to separate their values with a comma or semicolon, but that wouldn't be ideal. Even so, don't know how to tell WebFOCUS that those are individual, delimited values, rather than just a long string that happens to have semicolons or commas in it.


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Guru
posted Hide Post
Jeff, the text area may work in conjunction with the STRTOKEN function to split up the text with a delimiter.
We have done something where the users put the filters in a file (Excel in our case) and use that file as input to the fex.


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Silver Member
posted Hide Post
Thanks for the suggestion. I'm not familiar with the STRTOKEN expression. It looks like it's related to Maintain. Will that still work if I'm just trying split up a string to pass as individual values for a report?


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Expert
posted Hide Post
Jeff,

Not knowing what release, platform etc. you are on (see link on how to add these to your profile signature) or what experience of HTML and JavaScript you have, this can also be achieved within your launch page by using the JavaScript method "split".

What I use regularly is something like this (there is more involved but this sort of code is the basic part) -
function your_function() {
  parm_list = document.getElementById("textbox1");
  parm_array = parm_list.split(";");
  for (i=0; i<parm_array.length; i++) {
// Safety first check if exists and delete if necessary
    var RemCtrl = document.getElementById("parmvar"+i);
    if (RemCtrl) {
      document.form.removeChild(RemCtrl);
    }
    create_control("parmvar"+i,"parmvar",parm_array[i]);
  }
}

// Create a new input control from the supplied values
function create_control(ctrl,name,value) {
   var NewCtrl = document.createElement("input");
   NewCtrl.setAttribute("id", ctrl);
   NewCtrl.setAttribute("name", name);
   NewCtrl.setAttribute("type", "hidden");
   NewCtrl.setAttribute("value", value);
   document.form.appendChild(NewCtrl);
}

This will create one or many hidden inputs of the same name attribute and when the form is submitted, WebFOCUS will create the usual variables (using this code) of &parmvar, &parmvar0, &parvar1 etc.
&parmvar0 will hold the number of parmvar variables and each occurence will be suffixed with an indice.
&parmvar always holds the same value as &parmvar1 if it exists.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Sorry, forgot to say that if your user entered "string1;string2;string3;string4" then the variables passed to your fex would be -

&parmvar = string1
&parmvar0 = 4
&parmvar1 = string1
&parmvar2 = string2
&parmvar3 = string3
&parmvar4 = string4

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Silver Member
posted Hide Post
Thanks, Tony. I updated my signature, but after my first post. This looks like it might work. A little more coding than I had in mind, but...


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Guru
posted Hide Post
Jeff, STRTOKEN is a string function available in Reporting as well. You can look it up in Dev Studio help files.


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Silver Member
posted Hide Post
Thanks. I see the STRTOKEN in the help files. Do you have an example of a procedure using this method?


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Virtuoso
posted Hide Post
I know STRTOKEN from Maintain, but never from reporting.

STRTOKEN is an item in the MNTUWS subroutine library, specifically for maintain.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Silver Member
posted Hide Post
Tony, would you happen to have a relatively simple example of an HTML page and the FEX that it goes with? I think I understand how to use the Javascript, but am not sure how to make use of it. Thanks, again, for you suggestions.


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Expert
posted Hide Post
Jeff,

I am off today (so why am I posting? - sad boy Smiler) but I will try and knock a quick sample up for you. It won't have all the IBI js modules in the HTML so it will be concise and, hopefully, easier to understand.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Silver Member
posted Hide Post
Thank you very much, Tony!


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Virtuoso
posted Hide Post
Not being a javascript guru (although I DID copy Tony's code for later use), we accomplish the same task using Dialogue Manager:

-IF &ASSO_CD OMITS ';' GOTO ASO_LOOP;
-SET &ASSO_CD0=GETTOK(&MU_ASSO_CD,&MU_ASSO_CD.LENGTH,1,';',3,'A3');
-SET &ASO_TOK=2;
-SET &ASO_CNT=1;
-SET &ASO_IND=&ASSO_CD0;
-REPEAT ASO_LOOP WHILE &ASO_CNT LE &ASSO_CD0;
-SET &ASSO_CD&ASO_CNT.EVAL=GETTOK(&MU_ASSO_CD,&MU_ASSO_CD.LENGTH,&ASO_TOK,';',3,'A3');
-SET &ASO_TOK=&ASO_TOK + 1;
-SET &ASO_CNT=&ASO_CNT + 1;
-ASO_LOOP

The user enters values separated by ; In this case all values are three characters, thus, the A3. This could be parameterized as well if the values are variable length.

BTW: ASSO would be short for association. Haven't come up with a "nice" abbreviation for that one. Smiler Makes for interesting developer discussions.


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, 2007Report This Post
Expert
posted Hide Post
How about ASSN. I think that one is fairly common.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Silver Member
posted Hide Post
Interesting idea using dialogue manager. If dialogue manager could recognize the carriage return, maybe I could allow users to paste them in from Excel or something. I'm probably reaching.


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Virtuoso
posted Hide Post
Unfortunately WF strips out the carriage returns. Somewhere I have a small piece of js (1 line I think) that can replace the CR with another character which can then be used by DM to break the string.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
AH!!! My bad. I meant GETTOK not STRTOKEN. And Darin gave the example code up there. See, I need to work harder for that Platinum karma. Anyways, if your users would need to put it in an Excel anyway, might as well use an Excel File as an input into the fex.


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Expert
posted Hide Post
Alan,

You mean this, or something like it -

' Change linefeeds to HTML breaks
  Comment=Replace(Comment,vbcrlf,"<br>")

Although this is VBscript as opposed to JavaScript and I use it within ASP code.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Silver Member
posted Hide Post
Thank you very much! I'll give it a shot.

Jeff


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Expert
posted Hide Post
Jeff,

Sample HTML file -
<html>
<head>
<title>Parameter STring Parsing</title>
<script language=JavaScript>
function your_function() {
  parm_list = document.getElementById("textbox1").value;
  parm_array = parm_list.split(";");
  for (i=0; i<parm_array.length; i++) {
// Safety first check if exists and delete if necessary
    var RemCtrl = document.getElementById("parmvar"+i);
    if (RemCtrl) {
      document.form.removeChild(RemCtrl);
    }
    create_control("parmvar"+i,"parmvar",parm_array[i]);
  }
}

// Create a new input control from the supplied values
function create_control(ctrl,name,value) {
   var NewCtrl = document.createElement("input");
   NewCtrl.setAttribute("id", ctrl);
   NewCtrl.setAttribute("name", name);
   NewCtrl.setAttribute("type", "hidden");
   NewCtrl.setAttribute("value", value);
   document.form.appendChild(NewCtrl);
}
</script>
</head>
<body>
<form name="form" onsubmit="your_function();" method="get" action="/ibi_apps/WFServlet" target="_blank">
<input type="hidden" name="IBIAPP_app" id="IBIAPP_app" value="focalpoint">
<input type="hidden" name="IBIF_ex" id="IBIF_ex" value="parm_string.fex">
Enter your parms delimited by semi-colons:
<input type="text" id="textbox1" style="width:450px;" value="string1;string2;string3;string4">
<input type="submit" value="Run Report">
</form>
</body>
</html>

and the fex that it calls (very basic) -
-* File parm_String.fex
-SET &ECHO = ON;
-DEFAULT &parmvar = ''
-SET &T = '(''&parmvar.EVAL''';
-IF &parmvar0.EXISTS NE 1 THEN GOTO OUTLOOP1;
-REPEAT OUTLOOP1 FOR &COUNTER FROM 2 TO &parmvar0;
-SET &parmvarNEU = &parmvar.&COUNTER;
-SET &T = &T | ',''&parmvarNEU.EVAL''';
-OUTLOOP1
-SET &T = &T | ')';
-DONE

-TYPE &T.EVAL

T

p.s. Darin, note a slight mistake in the first function in the original JS Wink



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Thank you Tony, that's about it.

In js I get:
document.getElementById("textareaId").value=document.getElementById("textareaId").value.replace("%0D%0A","~")

and use the '~' in DM to split the items.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
I also use the ~ as the delimiter - doesn't get included in very many strings so the &VAR used in GETTOK is almost always parsed correctly.


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, 2007Report This Post
Expert
posted Hide Post
Jeff, download the manual "Using Functions" for version 76; its the shortest of the 4 manuals in the basic documentation set. And read the entire section on Text functions.
Focus has the coolest text unscrambling functions around. you can indeed recognize a carriage return. (or 'retour de charriot' as it says in french focus) Wink
or any character. look up HEXBYT, BYTVAL, and CTRAN. You'll copy and paste a carriage return character (mine show up as little boxes) into the BYTVAL function, extract its HEX value, and use that value in the CTRAN function to change it to a blank or a semi or whatever.
Focus text command are so strong you can take utter gibberish in and create poetry out.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Silver Member
posted Hide Post
Tony, I've taken your JavaScript, but am trying to tackle both requirements at once. I'm using a textarea, and allowing the user to enter a value, hit return, and enter another value. This is what I've done:



Parameter STring Parsing
<script language=JavaScript>
function your_function() {

parm_list = document.getElementById("textarea1").value;
parm_array = parm_list.split("\n");
for (i=0; i// Safety first check if exists and delete if necessary
var RemCtrl = document.getElementById("parmvar"+i);
if (RemCtrl) {
document.form.removeChild(RemCtrl);
}
create_control("parmvar"+i,"parmvar",parm_array[i]);
}
}

The only real change was that I'm trying to use the "\n" to split at the carriage return, instead of having the user separate the data with semicolons. I've also changed the input type to a textarea, so it will accept the hard returns. When I run the report, the form works. When I submit, I get this error.

I get this error: 0 ERROR AT OR NEAR LINE 28 IN PROCEDURE _parm_stringFOCEXE
(FOC257) MISSING QUOTE MARKS: '45202 ; | 'IBIAPP_

The strange thing is, that if I clear out the Textarea, and run the report again, it runs. I wonder if it's having trouble accepting the data separated by carriage returns, even though I'm not using them?

Am I being overambitious, trying to do this in one step? Thanks, again, for all of your help.

This message has been edited. Last edited by: Jeff Elam,


Jeff Elam
WF 8 in Windows
 
Posts: 44 | Location: St. Louis | Registered: September 17, 2004Report This Post
Expert
posted Hide Post
Jeff,

When ever you enter HTML into your post then your should put [ code] before it and [/code] after it, otherwise you get the HTML interpretted by the viewers browser.

Please edit your post above so that I can read your code without squinting at the page source Wink

To answer your last question, yes I think you may be being over ambitious if you do not know JS very much nor HTML and the DOM. We can assist you with the coding but you have to ask yourself the most important question -

Are your App Support people (or whom ever will support this code) within your Company, able to provide adequate support to your end result?

If the answer is no then I do not suggest that you attempt to put this into your code until the local support in capable.

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
BTW, read Alan's post above for a pointer.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Jeff,

Took your code and ran it and found I had the same problem.
First I thought that it was because the textarea1 will also be sent out to WF, and that still contains \n's. So I had the textarea1 cleared. That did not help, strange enough.
The next funny thing is, that when I changed the 'hidden' attribute to 'text' the problem went away. So now the only thing left is to craete the new fields as visible fields and immediately hide them again.
The following piece of js does just that:
<html>
<head>
<title>Parameter STring Parsing</title>
<script language=JavaScript>
function your_function() {
  parm_list = document.getElementById("textarea1").value;
  parm_array = parm_list.split("\n");
  for (i=0; i<parm_array.length; i++) {
// Safety first check if exists and delete if necessary
    var RemCtrl = document.getElementById("parmvar"+i);
    if (RemCtrl) {
      document.form.removeChild(RemCtrl);
    }
    create_control("parmvar"+i,"parmvar"+i,parm_array[i]);
  }
  document.getElementById("textarea1").value = '';
}
function create_control(ctrl,name,value) {
   var NewCtrl = document.createElement("input");
   NewCtrl.setAttribute("id", ctrl);
   NewCtrl.setAttribute("name", name);
   NewCtrl.setAttribute("type", "text");
   NewCtrl.setAttribute("value", value);
   document.form.appendChild(NewCtrl);
   NewCtrl.style.display = 'none';
}
</script>
</head>
<body>
Enter your parms separated by returns:
<br>
<form name="form" onsubmit="your_function();" method="get" action="/ibi_apps/WFServlet" target="_blank">
<input type="hidden" name="IBIAPP_app" id="IBIAPP_app" value="session">
<input type="hidden" name="IBIF_ex" id="IBIF_ex" value="parm.fex">
Enter your parms delimited by semi-colons:
<TEXTAREA name="textarea1" rows="10" cols="10">
</TEXTAREA><br><br>
<input type="submit" value="Run Report">
</form>
</body>
</html>

In parm.fex I have only a -? &, to show which variables I have avialable in the procedure.

Hope this helps, it certainly taught me something...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Jeff

I made a mistake in my original post, so to rectify, I have put Tony's code and the correct split together:
<html>
<head>
<title>Parameter String Parsing</title>
<script language=JavaScript>
function your_function() {
  parm_list = document.getElementById("textarea1").value;

  parm_array = parm_list.split("\r\n");
  for (i=0; i<parm_array.length; i++) {
    var RemCtrl = document.getElementById("parmvar"+i);
    if (RemCtrl) {
      document.form.removeChild(RemCtrl);
    }
    create_control("parmvar"+i,"parmvar",parm_array[i]);
  }
}

function create_control(ctrl,name,value) {
alert(ctrl)
   var NewCtrl = document.createElement("input");
   NewCtrl.setAttribute("id", ctrl);
   NewCtrl.setAttribute("name", ctrl);
   NewCtrl.setAttribute("type", "hidden");
   NewCtrl.setAttribute("value", value);
   document.form.appendChild(NewCtrl);
}
</script>
</head>
<body>
<form name="form" onsubmit="your_function();" method="get" action="/ibi_apps/WFServlet" target="_blank">
<input type="hidden" name="IBIAPP_app" id="IBIAPP_app" value="TESTS">
<input type="hidden" name="IBIF_ex" id="IBIF_ex" value="parm_string.fex">
Enter your parms delimited by semi-colons:
<textarea name="textarea1" id="textarea1" rows="10" cols="10">
</textarea>
<input type="submit" value="Run Report">
</form>
</body>
</html>


The parms should be available as in Tony's fex code as parmvar0 - parmvarnn. Try this code to get the idea of what is going on. (I also changed the setAttribute of name to use ctrl, not name).


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Alan,

The passing of "name" in the create_control function is purposeful and the distinct variables will be created by WF. If you change it to use "ctrl" then you may not get the "parmvar0" set properly to the count of the variables.

For Jeff's information, the variable(s) produced by this JS would all be called "parmvar". WF encounters more that one value for parmvar and creates an "array" and then creates an additional variable suffixed with "0" (zero) with the count of the incoming variables. If the variable names were changed by using "ctrl" value instead, then the variables passed to WF would be parmvar1, parmvar2, parmvar3 etc. and no parmvar0.

Hope that helps with the reasoning.

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Yes Tony, you are correct. I meant to say 'for testing I had changed name to ctrl so that I could pick up better in the URL', not that this was the way to go.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
  Powered by Social Strata Page 1 2  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Allow users to enter multiple values for a field in a launch page

Copyright © 1996-2020 Information Builders