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     [SOLVED] Capture multiple entries separated by CR or semi colon from text area

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Capture multiple entries separated by CR or semi colon from text area
 Login/Join
 
Silver Member
posted
Since my other post http://forums.informationbuild...1057331/m/7017015436 has been corrupted, I created this post with a solution that worked for me.
This works up to about 900 records (25 Characters) in my scenario. I use one of the suggestions from this post:
http://forums.informationbuild...447009495#7447009495

HTML page coding
<form method=post action="/ibi_apps/WFServlet" METHOD="post">
<input NAME="IBIF_ex" VALUE="multipart" TYPE="hidden">
<TEXTAREA NAME="PN" COLS=20 ROWS=20></TEXTAREA>


which calls this fex file: multipart

-REPEAT :ENDREPEAT1 FOR &I FROM 1 TO 2000

-SET &TOKEN = GETTOK(&PN,&PN.LENGTH,&I,';',25,'A25');

-IF (&TOKEN EQ '') GOTO :EXITREPEAT1 ;

-SET &INPUT.&I = LJUST(25,&TOKEN,'A25');
-:ENDREPEAT1
-:EXITREPEAT1
-*
-SET &COUNT_INPUTS = &I - 1 ;
-SET &J = 1 ;
-SET &WHEREIN = '''' | &INPUT.&J | '''';
-*
-REPEAT :ENDREPEAT2 FOR &J FROM 2 TO &COUNT_INPUTS
-SET &WHEREIN = &WHEREIN | ' OR ''' | &INPUT.&J | '''';
-:ENDREPEAT2

TABLE FILE PARTINFO
PRINT PART
WHERE PART CONTAINS &WHEREIN;
ON TABLE PCHOLD FORMAT EXCEL
END

This message has been edited. Last edited by: paulux99,
 
Posts: 36 | Registered: October 01, 2003Report This Post
Silver Member
posted Hide Post
I have not found an exact solution where I could use CR or LF in a text area instead of semi colon ;
Any suggestions?

This message has been edited. Last edited by: paulux99,
 
Posts: 36 | Registered: October 01, 2003Report This Post
Silver Member
posted Hide Post
If you can't get the textarea to do multiples. (and you should try adding multiple="multiple" operator="OR" to the textarea tag), then stripping carriage returns and line feeds is more simply done with javascript. By the time they get to the fex, they're already tossed out.

Here's an example that looks for a cr/lf combo following a word (the \b in the search string used by the .replace() method). Making sure it follows a word means that if your users enter blank lines or lines that contain only spaces you won't end up with extra ORs.

This is all handcoded. Again, if you've got HTML composer and all of its hooks in the HTML, try opening the file in a text editor and looking for the textarea tag and telling it that it's a multiple.

<html>
<script type=text/javascript id=makeparam>
	function adddelimiter(visibleid,hiddenid){
		var undelimited=document.getElementById(visibleid).value;
		document.getElementById(hiddenid).value=undelimited.replace(/\r\n\b/g, ' OR ');
	}
</script>
<body>
	<FORM id=form1 name=form1 action=/ibi_apps/WFServlet method="get">
		<input type='hidden' name='IBIMR_action' value="MR_RUN_FEX">
        <input type='hidden' name='IBIMR_sub_action' value="MR_STD_REPORT">
		<input type='hidden' name='IBIMR_flags' value="">
		<input type='hidden' name=IBIMR_domain value=mydomain/mydomain.htm > 
		<input type='hidden' name=IBIMR_folder value=#myfolder> 
		<input type='hidden' name=IBIMR_fex value=app/parts.fex> 
		<input type='hidden' name=ibif_ex value=app/parts.fex> 

		<textarea NAME=PN1 multiple id=PN1 cols=20 rows=20; ></textarea>
		<input type=hidden name=PN id=PN cols=20 width=20>
		<p>
		<input type=submit  onclick=adddelimiter('PN1','PN') >
	</FORM>
</body>
</html> 


WF: WebFocus 7.7.03
Data: Oracle, MSSQL, DB2
OS: Windows
Output: HTML/AHTML,PDF,EXL2K FORMULA, COMT
 
Posts: 43 | Registered: November 21, 2011Report This Post
Silver Member
posted Hide Post
Nd,
thanks for your suggestion, I am able to display: PART1 OR PART2 R OR PART3=1 OR PART4+1
but I am missing the single quote ' around the record so desired outcome would be to surround with single quote
WHERE PARTNO CONTAINS 'PART1' OR 'PART2 R' OR 'PART3=1' OR 'PART4+1'.
Assuming the js would need to be updated? or update parts.fex?
 
Posts: 36 | Registered: October 01, 2003Report This Post
Silver Member
posted Hide Post
something like
'\''  + \undelimited.replace(/\r\n\b/g, '\' OR \'') + '\'' 


should do it.

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


WF: WebFocus 7.7.03
Data: Oracle, MSSQL, DB2
OS: Windows
Output: HTML/AHTML,PDF,EXL2K FORMULA, COMT
 
Posts: 43 | Registered: November 21, 2011Report This Post
Master
posted Hide Post
Paulux,

it should work without additional coding.

FEX
TABLE FILE CAR
	SUM SALES
	BY CAR
WHERE CAR EQ &CAR.(OR()).Select cars.;
END


Save it.

Now make a new HTML.
Add a form.
Link the 'run' button to above fex.

Select "Textarea" as input type.

Check the properties of the textarea.

Multiple should already be set to "Multiple".

Only thing you have to do is set : "Multiple: Add quotes" to "Yes".

Good luck.
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Silver Member
posted Hide Post
Nd,
Thanks for update with single quote, when I update js coding with
document.getElementById(hiddenid).value='\''  + undelimited.replace(/\r\n\b/g, '\' OR \'') + '\'' ;
or this code
document.getElementById(hiddenid).value="'" + undelimited.replace(/\r\n\b/g, '\' OR \'') + "'" 

I get the error: "The website declined to show this webpage HTTP 403"
Both ie or firefox do not like the extra coding on single quote from js. I tried to lookup for a solution, I did not find anything.

Dave,
Thanks for suggestion, I am trying to copy and paste a single column of records with CR in excel (up to 1000 records) to a text area but maybe I can use some part of your suggested code.

This message has been edited. Last edited by: paulux99,
 
Posts: 36 | Registered: October 01, 2003Report This Post
Silver Member
posted Hide Post
403 is a web server error, and if you're curious, you should look into its logs to see just what it means.

I can offer a tidied, better tested version of the original javasctipt.
 
function adddelimiter(visibleid,hiddenid){
     var undelimited=document.getElementById(visibleid).value;
     var orvalue='\'' + ' OR ' + '\'';
     var newvalue='\'' + undelimited.replace(/\r\n|\r|\n\b/g, orvalue) + '\'';
     document.getElementById(hiddenid).value=newvalue;
	} 


You might look into codeacademy

Which offers free, interactive online lessons on several web concepts--include HTML, javascript, and jquery.


WF: WebFocus 7.7.03
Data: Oracle, MSSQL, DB2
OS: Windows
Output: HTML/AHTML,PDF,EXL2K FORMULA, COMT
 
Posts: 43 | Registered: November 21, 2011Report This Post
Silver Member
posted Hide Post
Nd, thanks for update.

Using your original code, I have replaced ' OR ' with ';' . This will work.
document.getElementById(hiddenid).value=undelimited.replace(/\r\n\b/g, ';');


then I use my original code in beginning of my post (fex: multipart). also, due to ie limitation on url, use METHOD="post" instead of get.

Thank for your help, yes I will definitively brush up on js.

This message has been edited. Last edited by: paulux99,
 
Posts: 36 | Registered: October 01, 2003Report This Post
Master
posted Hide Post
paulux99

textarea also supports linefeeds as separator.

, ; or linefeed is supported.

G'luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 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     [SOLVED] Capture multiple entries separated by CR or semi colon from text area

Copyright © 1996-2020 Information Builders