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] Problems with sorting in listboxes, downboxes

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Problems with sorting in listboxes, downboxes
 Login/Join
 
Gold member
posted
Hello,

I use non english collations with local characters like Ą, Ä, Š etc. By default Webfocus will sort letters like ABC...S....abc...s...Ä...Š. This is kind of computerized way, which not following rules of languages, wher usualy letters must be sorted like A,Ą,Ä,B...SŠ.... Letters with 'ogonek' or 'caron' have the same sorting weight like standard letters.

To solve the issue, I modified cpnnnnn.nls file. (Way how to do it described in http://www.informationbuilders...WFNSummer06AppCP.pdf)
I went to the server console NLS section, checked "recreate focus files' and restarted server.

As result, sorting in reports start to work like it must be. (Letters with caron goes after standard letter).

But sorting in listboxes and downboxes stays not changed (where letter with caron goes after Z). May be anybody knows how to solve this problem?

Thank you in advance.

WF7703
Tomcat standalone

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


Wf7704/WF8,Win64/32
 
Posts: 68 | Registered: February 20, 2004Report This Post
Virtuoso
posted Hide Post
Not possible I think. Sorting data in list- and dropdown-boxes is done using Javascript, and that language has no knowledge of NLS or any means to apply it to your strings.


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
Thank you Wep.

What do you think - is it set in Tomcat, or in Java on server machine or in ibi war files? Is there some webfocus xxx.js file source of problem? Or where it can be?

I was thinking that may be it is not a fault of Webfocus, but when I look on html code of particular listbox, there is a lot of parameters used by some of WF component. As result I feel that WF (some component) manage sorting in lists.

p.s. I spend some time to look more and more and more I am thinking that this is bug. For me it looks that WF manages sorting in listboxes and do it through (probably) ibirls3.js file. For sorting simple array.sort() is used which sorts in 'computerized' way, not according the language rules. How to solve this....?

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


Wf7704/WF8,Win64/32
 
Posts: 68 | Registered: February 20, 2004Report This Post
Expert
posted Hide Post
Piter, how do you create your dropdown lists? do you just point to a master file ? or do point to a fex to generate the list for you?
If you point to a fex, then you can order the elements anyway you want to.... does that make sense to you?




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
Virtuoso
posted Hide Post
quote:
Originally posted by Piter:
What do you think - is it set in Tomcat, or in Java on server machine or in ibi war files? Is there some webfocus xxx.js file source of problem? Or where it can be?

I was thinking that may be it is not a fault of Webfocus, but when I look on html code of particular listbox, there is a lot of parameters used by some of WF component. As result I feel that WF (some component) manage sorting in lists.

p.s. I spend some time to look more and more and more I am thinking that this is bug. For me it looks that WF manages sorting in listboxes and do it through (probably) ibirls3.js file. For sorting simple array.sort() is used which sorts in 'computerized' way, not according the language rules. How to solve this....?


I think it is indeed done in the ibirls3.js file, which means that the actual sorting happens client-side - in the user's web browser. It definitely doesn't happen in tomcat or the JVM or in an IBI war file, which means you have no control over this type of sorting.

But, as susannah correctly points out, if you use en 'external procedure' you can do the sorting anyway you want. It's just the 'embedded procedures' that are limited in this way. Using external procedures though, you will have to create a fex for every list in your launch pages that need alphabetical sorting. There's still the "old" method using !IBI.FIL.SOMEALPHAFILE; too, but I don't think that supports chaining of form-elements (never used it much).

Neither of the options is ideal.


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
Susanna, Wep

thank you for your help.

1. Wep - you are right - depending on version of browser, I can get correct sorting in listboxes. But it is a bit not enough for me. I like to have it correct in all cases.

therefore I start to look on Susanna's proposal.

2. I went via solution proposed by Susanna. When I create listbox, I point in DeveloperStudio - Dynamic, then I there are 2 choices - external or embedded procedure. When I point embedded, then it ask for .mas file. and as result creates something like

TABLE FILE MASTER
SUM FST.ID
BY NAME
ON TABLE HOLD FORMAT XML
END

If I run such procedure - in separate window - result (sorting) is correct. But result in list is wrong.

If I pointing use 'external procedure' (i.e. with the same content like above) then developer studio copies text of procedure into window and result is the same.

In both cases sorting incorrect.

What is strange, in generated HTML file there are 2 options:

sorttype="1" dosorting="1".

I was thinking, that If I will do sort in procedure, then I can switch sorting off (set to 0) and sorting on screen will be fine. But it looks that WF do not use sorting made by procedure.

What do you think about that - where I am wrong?

Thank you for your help.


Wf7704/WF8,Win64/32
 
Posts: 68 | Registered: February 20, 2004Report This Post
Virtuoso
posted Hide Post
If dosorting==1, sorting takes place in the browser, using locale-dependent string comparison:
Ib_dataInfoObject.prototype.doSorting = function (array)
{
    if(this.isSortingSet())
    {
        var object = this;
        sortValues  = function (first, second)
        {
            var byValue = object.isSortingByValue();
            var bDessending = object.isSortingDessending();
            var AllOptionElement1 = first.value;
            var AllOptionElement2 = second.value;
            if(AllOptionElement1 == allValue)
              return -1;
            if(AllOptionElement2 == allValue)
              return 1;
            var valueFirst = byValue ? first.value : first.dispValue;
            var valueSecond = byValue ? second.value : second.dispValue;

            if(valueFirst && valueSecond)
            {
                return bDessending ? valueSecond.localeCompare(valueFirst) : valueFirst.localeCompare(valueSecond);
            }
            return 0;
        };
        array.sort(sortValues);
    }
}  


So the results would indeed depend on "locale" setting in the client.



If you dosorting off, and turn off caching, I would expect the sort-order returned by your internal or external fex to be respected. (Even with caching on, I would still expect the matching subset to retain its order.)


If that's not the case, time to open a case with Customer Support.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
here's a q&d example of an external procedure that sorts stuff for a dropdown
DEFINE FILE IBISAMP/CAR
LEVEL/A10=DECODE COUNTRY ('ENGLAND' 'NONE' 
                           'JAPAN'  'CAR'
                           'ITALY'  'COUNTRY' ELSE 'MODEL');
LEVELORDER/I1=DECODE LEVEL ('NONE' 1 'CAR' 2 'COUNTRY' 3 ELSE 4);
END
TABLE FILE IBISAMP/CAR
SUM LEVEL BY LEVELORDER NOPRINT
ON TABLE PCHOLD
END


so write a fex that accomplishes the sort that you want, however you need to do that. store the fex in the same domain/folder as your launch page and report
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
Thank you, Susanna. Your solution work! I created fex, made reference to external procedure in DevStudio , refreshed procedure (in DevStudio), placed fex at WF server, new html on web machine and all works.

p.s. When I tried to implement your solution first time (and failed) I have not pressed "refresh external procedure" in Developer studio. As result, probably Developer studio was storing old references to wrong procedure.


Wf7704/WF8,Win64/32
 
Posts: 68 | Registered: February 20, 2004Report This Post
Gold member
posted Hide Post
quote:
Originally posted by j.gross:

If you dosorting off, and turn off caching, I would expect the sort-order returned by your internal or external fex to be respected. (Even with caching on, I would still expect the matching subset to retain its order.)


I have checked one more time. j.gross - you are right. Probably I was leaving "Sort" mark checked and as result, even my procedure was fine, browser was doing one more 'incorrect' sorting.

Thank you All for your help!


Wf7704/WF8,Win64/32
 
Posts: 68 | Registered: February 20, 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] Problems with sorting in listboxes, downboxes

Copyright © 1996-2020 Information Builders