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.
I have read the 3 pages of posts on multi select and I wanted to confirm my assumptions and see if there is a fix or if anyone has a workaround.
We are using version 7.1.1 and the following code does not work:
TABLE FILE EMPDATA SUM SALARY BY TITLE -IF &DIV0 LT 1 THEN GOTO NOLOOP; WHERE DIV EQ '&DIV1' -SET &CNT = 2; -LOOP -IF &CNT GT &DIV0 GOTO NOLOOP; OR '&DIV.&CNT' -SET &CNT = &CNT + 1; -GOTO LOOP -NOLOOP END
I understand that it was supposed to be a fix, but perhaps it didn't make it in the 7.1.1 patch.
When I do a multi select, I am able to use the operation = OR and it passes in what I need separated by OR's which is fine. What I need is to pass it in separated by commas or at least find a way to replace the OR with commas after the variable is passed. I was hoping the above code would work so I can cycle through each parameter passed and then concatenate a comma after, but it doesn't work.
I have tried CTRAN to replace the OR ascii wtih the ascii for comma but that isn't working... if I try to substring or edit out the OR, I fear I may edit out a parameter that has the letters o and r in it.
Does anyone have any ideas? What I want is to pass this into a SQL statement, so I need it to be where option in (&option) where &option are the values separated by commas... currently its works but they are separated by OR's.
Any ideas? Thanks so much in advance!
Dev, SIT, UAT, Production:7.6.6 Dev Sandbox:7.6.11
BUT it only works if you are getting this from the front end, I can't test it with just a -SET &DIV = '1' OR '2' OR etc... it doesnt' work which is fine because these values are coming from the front end anyway .
In addition, now that I have the 1 , 2 , 3 I would need those in single quotes because it is a varchar in the database.
Any suggestions on that (reassigning the single quotes around each value)?
To have it look like '1','2', etc...
Thanks so much for your feedback, you have given me a lot to work with which is what I am doing now, but any additional suggestions are welcome.
Dev, SIT, UAT, Production:7.6.6 Dev Sandbox:7.6.11
Once again I am posting to state that I have a function that replaces all I am just having a hard time working it into the html generated by Web Focus.
<script type="text/javascript"> function replaceChars(strText) { var strReplaceAll = strText; var out = "OR"; // replace this var add = ","; // with this var intIndexOfMatch = strReplaceAll.indexOf( out );
while (intIndexOfMatch != -1) { strReplaceAll = strReplaceAll.replace( out, add ) intIndexOfMatch = strReplaceAll.indexOf( out ); } return strReplaceAll; }
var strText="'sample' OR 'string' OR 'variable'" document.write(replaceChars(strText));
Dev, SIT, UAT, Production:7.6.6 Dev Sandbox:7.6.11
-* File or2com.fex
-SET &INPUT1='''VALUE''';
-SET &INPUT1='''VALUE1'' OR ''VAL2'' OR ''VAL3''';
-TYPE &INPUT1
-*******************************************************************
-SET &OUTPUT='';
-REPEAT ENDLOOP WHILE &INPUT1 CONTAINS ' OR ';
-* DETERMINE POSITION OF NEXT ' OR ' STRING.
-SET &POS=POSIT(&INPUT1,&INPUT1.LENGTH,' OR ',4,'I3');
-SET &POSM1=&POS - 1;
-SET &SUBSTR=SUBSTR(&INPUT1.LENGTH,&INPUT1,1,&POSM1,&POSM1,'A&POSM1.EVAL');
-* ADD IT TO THE OUTPUT STRING, BUT SEPARATED BY COMMAS.
-SET &OUTPUT=IF &OUTPUT EQ '' THEN &SUBSTR ELSE &OUTPUT || ',' || &SUBSTR;
-* REMOVE FOUND STRING AND ' OR ' FROM &INPUT1 AND THEN LOOP BACK.
-SET &POSP3=&POS + 4;
-SET &NEWLEN=&INPUT1.LENGTH - &POSP3 + 1;
-SET &INPUT1=SUBSTR(&INPUT1.LENGTH,&INPUT1,&POSP3,&INPUT1.LENGTH,&NEWLEN,'A&NEWLEN.EVAL');
-ENDLOOP
-SET &OUTPUT=IF &OUTPUT NE '' THEN &OUTPUT || ',' || &INPUT1
- ELSE &INPUT1;
-*************************************************************
-TYPE OUTPUT = &OUTPUT
Posts: 21 | Location: Texas | Registered: October 24, 2006
I have just reread my post and realised that it doesn't supply you with a full solution as to containing and calling it from within a WF generated HTML page.
The thing that you must remember is that WF inserts a couple of calls to be executed when the page loads and when it is submitted, and it is the submission that you want to intercept.
Have a look at the body tag of your HTML and see if there is an ONSUBMIT event trigger. If so then please post it. If you are forcing the embeded ORs in a single output variable using "operation=OR", then the call is probably SaveValues(); or something like that?
If this is in fact true then the function you are looking for is contained within IBIRLS.js and goes and does a whole load of things in the background. What you want to do is to do some processing after this function, so you can add your call after the SVAELVALUES(); in the onsubmit attribute - onsubmit="SaveValues();replaceChars(idattributevalue);" replacing the elements ID attribute value between the second braces.
In your function, use the getElementById syntax to prime an object vars with the object whose name contains the WF variable name where "item" below is the ID attribute value of the object required, -
function replaceChars(item) {
el = document.getElementById("item");
var out = "OR"; // replace this
var add = ","; // with this
el.value = strReplaceAll.replace(out,add);
}
You will have to check the URL produced to see if this is enough as I think that the URL string is produced by the SaveValues(); function.
Of course if you are not using the SaveValues(); function then you just have to add the onsubmit call in your form tag (or submit button).
Not sure if I've not confused you, but good luck anyway!
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, 2004
Tony, thanks for pointing out that semicolon.. I must have missed that... which takes care of some of the syntax errors I was getting.
Bernie Ott... your solution has worked for me and I tried a number of different ways for the letters OR to be in the word and it does not replace them if they are in the single quotes. Just for example I tired: OREO, OREGON, DEBORAH, FORWARD, FORLORN...
Tony, I am still going to try the javascript so that it helps me get a better grasp on what is going on, but the warning is what kinda pushes me away, I would not want to replace those OR's and as of now I have a solution per Bernie.
You people are amazing! Thank you so much!
Dev, SIT, UAT, Production:7.6.6 Dev Sandbox:7.6.11