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.
Hi all, I am just having way more problems with this than I should.
I have a multiselect capable list box that will pass in a list of numbers. This works wonderfully for use in the report however I also need to manipulate these values to a different format.
The values passed look like: '1' OR '3' OR '12' OR '640'
I need to convert these numbers into a string where each number is padded with leading zeros up to three digits long and concatonated together. 001003012640
Every character function I throw at my parameters only returns the first value of 1.
How can I get around this?
Thanks.This message has been edited. Last edited by: lenny,
WebFOCUS 8202M Client: Windows Server 2012R2/Tomcat 8.0/IIS Server: IBM i v7r2m0 MS-SQL
You should try to use the same table where is your data with an EDIT, ACROSS and a -READ
example using the CAR FILE
-SET &VAR1 = '''1'' OR ''3'' OR ''12'' OR ''640'''; DEFINE FILE CAR MYSORT/I3=DECODE SEATS ('5' 1 '2' 3 '4' 12 ELSE 640); MYDATA/A3=EDIT(MYSORT); END TABLE FILE CAR WHERE MYSORT EQ &VAR1 SUM MYDATA ACROSS MYDATA ON TABLE SAVE FORMAT ALPHA END -RUN -READ SAVE, &MYDATA -RUN -TYPE &MYDATA
Replace each ' OR ' with two spaces plus a carriage return and line feed before placing into a temporary file. Now read that file line by line, adding a little FPRINT magic along the way ....
By pushing the crlf in front of each number it effectively left justifys each one on a new line with at least two trailing spaces, giving a minimum of 3 chars per line. Tell FPRINT that these are formatted as integers with leading zeroes and voila ....
-DEFAULT &VAR4 = '';
FILEDEF VARLIST DISK VARLIST.FTM
-RUN
-SET &VAR1 = '''1'' OR ''3'' OR ''12'' OR ''640''';
-SET &VAR2 = STRREP(&VAR1.LENGTH,STRREP(&VAR1.LENGTH,&VAR1,1,'''',0,'x',&VAR1.LENGTH,'A&VAR1.LENGTH'),4,' OR ',4,' '|HEXBYT(13,'A1')||HEXBYT(10,'A1'),&VAR1.LENGTH,'A&VAR1.LENGTH');
-WRITE VARLIST &VAR2
-READ VARLIST NOCLOSE &VAR3.3
-REPEAT :Loop WHILE &IORETURN EQ 0;
-SET &VAR4 = &VAR4||FPRINT(&VAR3,'I3L','A3');
-READ VARLIST NOCLOSE &VAR3.3
-:Loop
-TYPE &VAR4
Editted to add -
Hmmm, just spotted that Waz had used FTOA in the same way, ah well great minds thnk alike ..... etc.
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
Not being nearly as clever as the previous posters, I typically cheat and use Javascript functions for this type of parameter manipulation! The example below is what I use to get an in-list for use with SQL (for example, 'A', 'B', 'C', 'D').
So if this is my function:
function fsuMultiSelectGetInList(selID, inputID) {
var objSel = document.getElementById(selID);
var objInput = document.getElementById(inputID);
var objOpt;
var i = 0;
var strInList = "";
for(i=0; i<objSel.options.length; i++) {
objOpt = objSel.options[i];
if(objOpt.selected) {
if(strInList != "") {
strInList += ", ";
}
strInList += "'" + objOpt.value + "'"
}
}
objInput.value = strInList;
}
And then I use the variable value from the hidden text box (&atyp) in my FEX, instead of the value from the select object. The code could easily be adapted to your purpose by checking the length of each option value and adding zeroes as necessary.
- Just another option for others who happen on the post!
Rob
WebFocus 8201m on Windows; App Studio 8201; Procedures: WebFocus with SQL; HTML Parameter Pages & Dashboard; Output: Excel, HTML, & PDF.
Posts: 88 | Location: MI | Registered: July 23, 2009
If I use a multi-select control, by default I only get the first value selected. Must be something different I'm doing, however, getting to multiple values like that is actually quite easy!
Say the multi-select has a control named VAR (like in the other examples), then in your report you have a variable &VAR. This variable only contains the first value, bummer...
BUT, there is also a variable &VAR0 that tells the number of values and variables &VAR1...&VARn with each value.
So you can do something like this:
-REPEAT :LOOP FOR &N FROM 1 TO &VAR0
-SET &NEWVAR = EDIT(&VAR.&N, '999');
-:LOOP
Note that if there's only one value selected, the variables &VAR0..&VARn don't exist, so you'll have to work around that by, for example, defining default values for those variables.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
Yes, but that requires the wildest string parsing in the OP's case, while the values are already separate in my case. I suspect that may be more convenient to the OP - which is why I mentioned it.
Knowing that the behaviour gets changed by that "operation" option is good to know, though, both for us and for the OP.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
Here I couldn't find one way to get this to work and I have numerous options of how to solve my dilemma. It's going to be a very exciting week working through all these ideas.
Thank you all so much!
WebFOCUS 8202M Client: Windows Server 2012R2/Tomcat 8.0/IIS Server: IBM i v7r2m0 MS-SQL
but that requires the wildest string parsing in the OP's case
In this case, yes I agree, but otherwise it depends upon how it's going to be used.
As implied by yours, and Robs responses (and of course others) the end requirement should be studied to decide which is the best point at which to do the processing best suited to the end requirement.
Like Rob, if I were writing this process, I would likely achieve it within the web page. But then that is only from information given within this post. If we knew (and had asked for) more information then that may change.
However, we need to remember that not all the members (and other viewers) of this forum are experienced in all aspects of developing a complete solution, and will consequently achieve it within the bounds of their own personal knowledge and ability.
I'm sure that the potential methods given here will help, not only Lenny, but many other visitors looking for a similar solution to a troublesome requirement.
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