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] long string - search more than 4096 characters?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] long string - search more than 4096 characters?
 Login/Join
 
Platinum Member
posted
Hi,
I have an HTML page with several controls including an EDIT BOX.
EDIT box is used to search PART numbers.
User can enter multiple Part numbers using "^" delimiter.
The length of the Part number varies.
I am able to replace '^' to ' OR ' and use that in my where clause.
Here is the code I am using to convert '^' to ' OR ' .


-SET &VALS = ∂
-SET &VALS2 = &VALS.LENGTH + 1365;
-SET &VALS3 = 'A' | &VALS2;
-SET &VALSX = STRREP(&VALS.LENGTH,&VALS,1,'^',6,''' OR ''',&VALS2,'&VALS3');
-SET &VALSX = TRUNCATE(&VALSX);
-SET &PART = &VALSX;



The issue I am facing now is that the length of the Input string could be more the 4096 characters and STRREP doesn't like that.
Not sure how to get around it.

How do I work around it?

Thanks

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


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
One question : How and Why a user would enter 4096 characters in a search string ???

According to me, if your users may enter that much of data as for a selection (filter), you should think of another way to select those many part numbers...


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
User may get list of parts from the customer.
The length of each Part numbers can go from 5 character to 25 characters.
If the user wants to search 400-450 parts which is quiet normal then the length of the variable string goes over 4096 character.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Hi BM,

You don't specify the OS in your signature, so am guessing, but

I was thinking, if WebFOCUS can't do it, then perhaps something else can.

Some of the options I can think of are:


  • Call an OS command and pass the string. Don't know if you are on Windows, Unix, Linux, other
  • Use SQL, assuming ANSI SQL can do it in an function call. Or if you have an SQL adapter, then a specific DB function call.


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
Thanks.
OS is Windows.

Would you be able to elaborate on the options you have suggested?

Thanks again for all your help


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
quote:
User may get list of parts from the customer.

How this list is provided and in which format ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Virtuoso
posted Hide Post
Hi BM

This is off the the top of my head but what about using substring to break the string down to 4096 chunks and creating more than one &variable to manipulate


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by MartinY:
quote:
User may get list of parts from the customer.

How this list is provided and in which format ?


Its in a text format.
User enters them in a EDIT BOX (&PART) with "^" delimiter.
I am able to add replace '^' with ' OR ' and use that in my WHERE CLAUSE.
Issue is if the the length &PART goes over 4096 then it doesn't work.
Here is the code I amusing to replace "^" to " OR ".

-SET &VALS = ∂
-SET &VALS2 = &VALS.LENGTH + 1365;
-SET &VALS3 = 'A' | &VALS2;
-SET &VALSX = STRREP(&VALS.LENGTH,&VALS,1,'^',6,''' OR ''',&VALS2,'&VALS3');
-SET &VALSX = TRUNCATE(&VALSX);
-SET &PART = &VALSX;


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by Chuck Wolff:
Hi BM

This is off the the top of my head but what about using substring to break the string down to 4096 chunks and creating more than one &variable to manipulate


Hi,
This is what I am struggling with...Since the lenght of each Partnumber in the string varies 4096 chunk could break the value of the PartNumber.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
BM,

My question was to understand How does your user do receive the part list from the customer.
The way that the user actually enter the part list in a edit box was clear. This is where is your issue.
I'm wondering how do this list is provided to your users BEFORE they enter it in the edit box.

Maybe something could be done using that input list and avoid manual entry of part numbers.

Having users to type in several numbers (from 5 to 25 digit) with a "^" as delimiter can create so many entry errors that this is from where you need to take action to eliminate that manual entry.

So I repeat my question : From where, how and in which format does the part number list is given to your users BEFORE they enter it in you edit box ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
Oh now I know what you mean. sorry for the confusion.
The user may get the list from the customer in a PDF or in a spreadsheet.
Or they may create a list of "Focus" parts to track for their Business Unit.
Majority of the time the list is manageable.
Its just sometimes we do get those strange request and not sure how to tackle it.
I was thinking of maybe creating a table off of the list but not sure how.

Thanks


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
In situations like this in the past I have used JavaScript to do the replacement. Here is some sample code that you can try to see how it would work:
 <html>
 <script>
 function replacetext() {
    var parts = document.getElementById("edit1");
    parts.value = parts.value.replace(/\^/g,"' OR '");
 }
 </script>
 <input id=edit1 onkeyup=replacetext() size=100></input>
 </html>

You could incorporate the two lines of code in the function into your HTML Composer/Canvas page to run when your run button is clicked.


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Expert
posted Hide Post
quote:
Would you be able to elaborate on the options you have suggested?



I just has a thought.

Can you -WRITE the string to a file, then -READ it or create a master file for it and TABLE FILE it ?


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
Expert
posted Hide Post
How about taking that list of part numbers and writing them to a file, then use "WHERE PART_NUMBER IN FILE (FileName)" (I think that the syntax, maybe?)?




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
quote:

The user may get the list from the customer in a PDF or in a spreadsheet.
Or they may create a list of "Focus" parts to track for their Business Unit.

Since it doesn't seems to always be the same way that the data is "received", dbeagan look like your best and simplest option
 function replacetext() {
    var parts = document.getElementById("edit1");
    parts.value = parts.value.replace(/\^/g,"' OR '");
 }


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
thanks all.
Will give javascript replacement a try and get back.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by Waz:
quote:
Would you be able to elaborate on the options you have suggested?



I just has a thought.

Can you -WRITE the string to a file, then -READ it or create a master file for it and TABLE FILE it ?


Thanks .. not sure how to do that.
Do you have any example or post you can point to?


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
Hi BM

Since your limitation is the 4096 limit for STRREP I think the javascript is your best option.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Virtuoso
posted Hide Post
quote:
Since your limitation is the 4096 limit for STRREP I think the javascript is your best option.

I do agree, as I already mentioned and it's much more simplest then perform -WRITE, create a master file and -READ to then perform other action on the string.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
Thanks all. Javascript it is Smiler


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
quote:
Thanks all. Javascript it is


Let me know if you need the other option.


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
quote:
Originally posted by Waz:
quote:
Thanks all. Javascript it is


Let me know if you need the other option.


For now I have used the javascript and its working well but for sure I would like to learn the other option Smiler.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
The Idea, I had was to -WRITE out the &Var, then -READ bit of it into new vars.

You could also use a TABLE FILE to do things as well, but this is the simple example.

-SET &BASE = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ' ;
-SET &BASE1K = &BASE | &BASE | &BASE | &BASE | &BASE | &BASE | &BASE | &BASE | &BASE | &BASE ;

-SET &TEST = '' ;
-REPEAT LOAD FOR &CNTR FROM 1 TO 5 ;

-SET &BLK = DECODE &CNTR(1 'A' 2 'B' 3 'C' 4 'D' 5 'E' ELSE 'X') ;

-SET &TEST = &TEST || &BLK || &BASE1K ;

-LOAD

-*-TYPE &TEST

FILEDEF TESTFILE DISK test.ftm

-RUN

-WRITE TESTFILE &TEST

-READ TESTFILE &BLOCK1.A1000. &BLOCK2.A1000. &BLOCK3.A1000. &BLOCK4.A1000. &BLOCK5.A1000. 

-TYPE BLOCK1 = &BLOCK1
-TYPE BLOCK2 = &BLOCK2
-TYPE BLOCK3 = &BLOCK3
-TYPE BLOCK4 = &BLOCK4
-TYPE BLOCK5 = &BLOCK5


* Tested on a linux environment


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
  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] long string - search more than 4096 characters?

Copyright © 1996-2020 Information Builders