KB4997728: SalListSelectString finds wrong strings if the list is unsorted

Post found bugs and possible workarounds.
Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 77
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

KB4997728: SalListSelectString finds wrong strings if the list is unsorted

Post by Igor Ivanovic » 12 Apr 2017, 07:58

When used on an unsorted combo or list box the function returns wrong results.
If you have a list of:

Code: Select all

Zagreb
Denver
Chicago
Den
and search for Den, the function will return Denver.

The workaround for a normal combo or list is to use VisListFindString which will return the correct item.

The above workaround isn't working if used on unsorted dropdown column in a grid or table, due to the TD23473 bug: VisListFindString always returns zero when used on dropdown column.
Still no TD bug number.
Igor Ivanovic
Image

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 77
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Igor Ivanovic » 12 Apr 2017, 10:20

Just received the answer from OpenText:
SalListSelectString: Finds and selects a combo box or single-selection list box entry.
I have also reviewed and discussed internally. Apparently VisListFindString is designed to do exact match. For flexibility, SalListSelectString is designed to select first occurenece of keyword in a string. As such, this is not deem as bug.
Should you need the feature to perform exact match, please consider to use VisListFindString.
So, its by design!
It would be partially Ok if the documentation mentions that, but it doesn't.
And how could it be by design for unsorted lists as it returns the wrong selection.
Igor Ivanovic
Image

Charlie
Canada
Posts: 47
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Charlie » 12 Apr 2017, 10:39

Thanks Igor !

This is something I noticed long ago with SalListSelectString. Whenever we would run into a problem, I'd go modify the source code tables to make the strings different.

I'm kicking myself in the rear for not thinking about VisListFindString...
A little trick to help direct folk from old Gupta forum to this one: Link to post

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 77
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Igor Ivanovic » 12 Apr 2017, 14:42

You are welcome!

I missed this until now, as all of our combo/list boxes were sorted.
But now the client wanted to have the items populated by creation date and not sorted so the problem showed right away.
It wasn't noticed by us until the client started using it, as our test data was different one from another, but the client uses very similar data...
Igor Ivanovic
Image

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 89
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Jeff Luther » 12 Apr 2017, 15:36

But now the client wanted to have the items populated by creation date
Just to clarify: You can populate a listbox sorted by creation date [of the DB data rows] with an appropriate SELECT... ORDER BY command.
But, are you saying that the listbox attribute itself has to be Sorted: Yes or you cannot find the correct listbox entry??


As to your earlier msg. about a "Denver" return with an UNsorted list like: Zagreb, Denver, Chicago, Den
when you search for "Den" that is correct, it seems to me. It is finding the first occurrence of a string beginning with 'Den'.

As I replied just now to another related msg. here of yours, a test case can help sort (me) this out. And maybe help me understand what I'm not ;)
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Charlie
Canada
Posts: 47
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Charlie » 12 Apr 2017, 17:08

Jeff Luther wrote:
12 Apr 2017, 15:36

Just to clarify: You can populate a listbox sorted by creation date [of the DB data rows] with an appropriate SELECT... ORDER BY command.
But, are you saying that the listbox attribute itself has to be Sorted: Yes or you cannot find the correct listbox entry??
Nope, attribute is Sorted: No (so that the list is sorted as per database "order by", and not by alphabetical order of the values in the list.)

As to your earlier msg. about a "Denver" return with an UNsorted list like: Zagreb, Denver, Chicago, Den
when you search for "Den" that is correct, it seems to me. It is finding the first occurrence of a string beginning with 'Den'.
SalListSelectString for "Den" that matches some code value ( = 1, or 2, or 3, or whatever) would select "Denver", which isn't correct when trying to select the value that matches a code for "Den". For that kind of behaviour, VisListFindString gets the index of the exact textual match, and then selection of the string via index will select "Den". If that makes any sense...
A little trick to help direct folk from old Gupta forum to this one: Link to post

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 89
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Jeff Luther » 12 Apr 2017, 17:50

If that makes any sense...
Perfect sense. VisListFindString is an exact match/string literal search, SalListSelectString is essentially a wildcard search, a kind of find 'den%' so 'denver' would be found first if it was above 'den.'
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Charlie
Canada
Posts: 47
Joined: 07 Mar 2017, 18:52
Location: Fredericton, New Brunswick, Canada

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Charlie » 12 Apr 2017, 19:45

Oh no. All of that reminded me of these lyrics (the song is now stuck in my head, and misery loves company):
You may be right
I may be crazy
But it just may be a lunatic you're looking for ...
To look at me, you may think the hamster is dead. Yet the wheel is always spinning ...
A little trick to help direct folk from old Gupta forum to this one: Link to post

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 89
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Jeff Luther » 13 Apr 2017, 00:21

Don't worry, Charlie. The hamster's not dead; it's just a bit too cold yet up there in N.B.! Maybe they hibernate in your area??

In any case, I don't know, guys :? I've attached a test case that works just as predicted to me. Sure, unsorted SalList will return the first 'Den' even if it's part of 'Denver' which is first in the list. (It's a 'primitive' function.) And with sorted both SalList and VisList work correctly, since 'Den' is first in the list. What am I missing here?

As for a bit of history, the VIS toolchest came from a 3rd party a few decades ago. I don't remember who. SQLWindows was first released in Sept., 1988, so my guess is that the VIS toolchest was licensed/bought within a year or 3 of that. And the VIS toolchest was an improvement for many of the SAL functions. (Maybe read 'improved' as 'corrected').

If I didn't write this test correctly Igor, Charlie, et al, feel free to modify and attach your changed version so I can see what all the hubbub is about. Thx.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 77
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Igor Ivanovic » 13 Apr 2017, 06:52

Here is my repro I sent to OpenText.

The problem is that the function returns wrong item when the list isn't sorted, ie. Sorted: No.
We found it when we were trying to make a workaround for a bug in using VisListFindString in a dropdown column.

For me it makes perfect sense that it is working like it does now for sorted list, Sorted: Yes, but what's the point for unsorted ones?
There are a number of workarounds for this, using a loop and checking every time if we received an exact string, and so on...

The same thing I wrote when OpenText closed the case with "as designed", and afterwards reopened it. Will see...

What do you guys think?
You do not have the required permissions to view the files attached to this post.
Igor Ivanovic
Image

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 89
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Jeff Luther » 13 Apr 2017, 17:08

Yes, I see this: 'Den' returns as I found earlier. What is surprising is that the VisList function returns -1 when searching for 'd' or 'de'.

Keep us posted any updates from O/T for this bug, Igor.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 77
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SalListSelectString finds wrong strings if the list is unsorted

Post by Igor Ivanovic » 13 Apr 2017, 21:50

The final verdict:
Understand that Vis will be fixed. As such, once it is fixed, the recommendation to use Vis will be available.
Since Vis can provide the exact match function, there is no need for sallistselectstring to be changed as some other users are using due to its ability to find the first occurrence of search string in the first occurrence of the hits.
Igor Ivanovic
Image

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 278
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: KB4997728: SalListSelectString finds wrong strings if the list is unsorted

Post by Dave Rabelink » 12 May 2017, 11:21

This behaviour is described in OpenText knowledgebase.

KB4997728: Team Developer - SalListSelectString() does not perform an exact match search

https://knowledge.opentext.com/knowledg ... /KB4997728
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “Bug Reports”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests