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] Removing OR and single quote from a drop down selected values.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Removing OR and single quote from a drop down selected values.
 Login/Join
 
Gold member
posted
In the HTML file we got a drop down which can select multiple values. when we select multiple values the selected value is stored in &PRODUCTCODE the value is '14' OR '35' OR '21'. Can we remove single quote and OR from this and can i have in this pattern 14,35,21.

Is this possible??

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


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
Gold member
posted Hide Post
Can anybody respond to it??


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
<JG>
posted
Yes but I'm not going to until you've read the manual and looked at character functions
 
Report This Post
Gold member
posted Hide Post
Dear JG,

I read the manuals and found that i can use STRREP
-SET &PRODUCTCODE1 = '14 OR 35 OR 21';
-SET &PRODUCTCODE = STRREP (&PRODUCTCODE1.LENGTH, '&PRODUCTCODE1.EVAL', 4, ' OR ', 1, ',', 40, 'A40');

-TYPE &PRODUCTCODE1
-TYPE &PRODUCTCODE

In this case my output is 14,35,21 perfect.

But My String is
-SET &PRODUCTCODE1 = ''14' OR '35' OR '21'';

here if i can remove single quote first then half the work is done.

Can u help me out now??

Thanks and Regards
Ur Santhu


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
<JG>
posted
Good attempt,

Two stage process

1st use the STRIP function to remove the single quotes.

-SET &PRODUCTCODE = '''14'' OR ''35'' OR ''21''';
-SET &PRODUCTCODE=STRIP(&PRODUCTCODE.LENGTH, &PRODUCTCODE , '''', 'A&PRODUCTCODE.LENGTH');
-SET &PRODUCTCODE = '14 OR 35 OR 21';
-SET &PRODUCTCODE = STRREP (&PRODUCTCODE.LENGTH, '&PRODUCTCODE.EVAL', 4, ' OR ', 1, ',', 40, 'A40');
-TYPE &PRODUCTCODE
 
Report This Post
Gold member
posted Hide Post
Thank you JG,

small problem is you placed two single quotes for each value.
In My string only one single quote is being used.
-SET &PRODUCTCODE = ''14' OR '35' OR '21'';

Please tell some solution for this...


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
Gold member
posted Hide Post
Dear JG can you solve this problem...


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
Gold member
posted Hide Post
can anybody respond to this query???


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
<JG>
posted
Santhu, you really must get some basic training.

The reason for the multiple single quotes is to construct a string like yours.

Just run the code with -SET &ECHO=ALL; as the first line and you will see that it
is exactly what you want.
 
Report This Post
Gold member
posted Hide Post
quote:
-SET &PRODUCTCODE = ''14' OR '35' OR '21'';


No JG,
you used this string '''14'' OR ''35'' OR ''21'''
But i am using this string ''14' OR '35' OR '21''
there is a difference of string. what i use and you use .
So, Please try to use this string ''14' OR '35' OR '21'' and get this output '14 OR 35 OR 21'

Regards,
Ur Santhu


WebFOCUS 8.0.0.7 App Studio
 
Posts: 67 | Registered: September 26, 2008Report This Post
<JG>
posted
If you do not want to test the code with the ECHO ON
so that you can actually see what it is doing then there is
absolutely no point in trying to help you.
 
Report This Post
Expert
posted Hide Post
Santhu,
download the USING FUNCTIONS manual
read the CTRAN function
you can translate any character string to anything else you want
eg the values for blank, apos, and quote
are 32,39, and 34 respectively.
turn on the echo as jg suggests, and look at your results




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
Expert
posted Hide Post
This may not be the neatest way to do this and only gets rid of the OR's but maybe you can change it to suit your needs. This is code I wrote almost two years ago to help a developer and hasn't been touched since. It should run by itself.
-* File ar_where_loop.fex
-SET &DIVISION = &DIV.(OR(<AM,AM>,<CHE,CHE>,<CHW,CHW>,<CP,CP>,<CT,CT>,<CV,CV>,<FOR,FOR>,<GB,GB>,<GC,GC>,<GU,GU>,<IR,IR>,<KI,KI>,<KSE,KSE>,<KSW,KSW>,<KY,KY>,<LS,LS>,<MR,MR>,<MTN,MTN>,<MTS,MTS>,<NC,NC>,<NE,NE>,<NEE,NEE>,<NEW,NEW>,<NK,NK>,<NWE,NWE>,<NWN,NWN>,<NWS,NWS>,<NWW,NWW>,<OT,OT>,<PRN,PRN>,<PRS,PRS>,<PRW,PRW>,<RR,RR>,<SC,SC>,<SFE,SFE>,<SFW,SFW>,<SO,SO>,<SWE,SWE>,<SWW,SWW>,<TCE,TCE>,<TCS,TCS>,<TCW,TCW>,<TX,TX>,<UP,UP>)).Select one or more DIVISIONS. ;
-***** EXAMPLE of selection ****
-* DIV = 'AM' OR 'CHW' OR 'CP' OR 'FOR'

-*  Loop thru this list & add single quotes and commas where necessary around options - to go in the SQL IN statement
-*  NEED TO TAKE THE "OR" OUT OF THE STRING PASSED FROM THE WEB SERVER

-SET &IVTGTYP=&DIV;
-SET &LENGTH_LEFT  = &IVTGTYP.LENGTH;
-SET &WHR = '  ';

-DIVLOOP
-SET &SP_POS=POSIT(&IVTGTYP,&LENGTH_LEFT,' ',1,'I2');
-* IF THERE ARE NO MORE ORS, YOU HAVE THE LAST ONE AND CAN EXIT THE LOOP.
-IF &SP_POS NE 0 GOTO DIVGET;
-SET &DIVTOK=&IVTGTYP;
-GOTO DIVEND
-DIVGET
-SET &TOKEND=&SP_POS-1;
-SET &TOKLEN=&SP_POS-1;
-SET &TOKFMT='A'|&TOKLEN;
-*-TYPE SP_POS=&SP_POS TOKEND=&TOKEND TOKLEN=&TOKLEN
-* GET THE FIRST DIVISION IN THE STRING
-SET &DIVTOK  = SUBSTR(&LENGTH_LEFT, &IVTGTYP, 1, &TOKLEN, &TOKLEN, '&TOKFMT');
-*-TYPE DIVTOK=&DIVTOK
-* MOVE THE STARTING POSITION PAST THE EXTRACTED DIVISION AND THE ' OR ' AND GET THE REST OF THE STRING.
-SET &STR_START=&TOKLEN+5;
-SET &STR_LENGTH=&LENGTH_LEFT;
-SET &LENGTH_LEFT=&LENGTH_LEFT-&TOKLEN-4;
-*-TYPE LENGTH LEFT=&LENGTH_LEFT STR_START=&STR_START STR_LENGTH=&STR_LENGTH
-SET &STRFMT='A'|&LENGTH_LEFT;
-*-TYPE STRFMT=&STRFMT
-SET &IVTGNEW=SUBSTR(&STR_LENGTH,&IVTGTYP,&STR_START,&STR_LENGTH,&LENGTH_LEFT,'&STRFMT');
-*-TYPE &IVTGNEW
-SET &IVTGTYP=&IVTGNEW;
-SET &WHR  =  &WHR || &DIVTOK || ',';
-GOTO DIVLOOP
-DIVEND
-SET &WHR  =  &WHR || &DIVTOK;
-* Parameter is set to pass to SQL select statement
-*-SET &FWHR  =  &WHR ;
-TYPE &WHR


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
Expert
posted Hide Post
This Dialogue Manager command:

-SET &PRODUCTCODE1 = ''14' OR '35' OR '21'';
produces this error when executed in v7.6.5:

 0 ERROR AT OR NEAR LINE      3  IN PROCEDURE ADHOCRQ FOCEXEC *
 (FOC261) EXPRESSION IS INCOMPLETE BECAUSE AN OPERATION IS MISSING
There's not enough apostrophes in the code.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
<JG>
posted
quote:
-SET &PRODUCTCODE1 = ''14' OR '35' OR '21'';


Francis you are absolutely correct.

That's why in the example that I posted for Santhu my code was

-SET &PRODUCTCODE = '''14'' OR ''35'' OR ''21'''; (WF767 is what I used)

To code it longhand (the old fashioned way)

-SET &PRODUCTCODE = '''' || '14' || '''' || ' OR ' | '''' | '35' ||'''' || ' OR ' | '''' || '21' || '''';

Both generate the required input string you would get from a multi select drop down.

The problem is Santhu does not understand even the basics of WebFOCUS and he wants someone to do his job for him
but he is not prepared to accept the advice given.

What he wants is a simple 2 stage process

STRIP
STRREP

Ginny, 2 lines not a book.
 
Report This Post
Virtuoso
posted Hide Post
Santhu,

You seem to be having a hard time understanding the recommendations of your fellow Focal Pointers. If you do not understand it, then do it another way. I would suggest that you use JavaScript. If you change your PRODUCTCODE from a list box to a hidden input, then add another list to contain the original list, you can add some JS code prior to the OnExecute() function to set the value of PRODUCTCODE to the desired value.

Hint: If you use the Prototype JavaScript Framework 1.6 or higher, this can be done in one line of JavaScript.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report 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] Removing OR and single quote from a drop down selected values.

Copyright © 1996-2020 Information Builders