Subscribe Bookmark RSS Feed

How to make a List Box() case sensitive?

msharp

Super User

Joined:

Jul 28, 2015

How do you make a list box case sensitive?  For example I want the following script to show all five items except it will only show the first item.

list = {AAA,aaa,AaA,AAa,aaA};

New Window("Example", ListBox( list ));

Each item is distinct, and would be understood by the end user.  Please help!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Maybe this is intended behaviour, but it looks more like a bug to me - Please do send an email to support@jmp.com which is one way into the formal Tech Support system.

As a workaround you could try the approach below. Depending on details, you may also need 'Trim()' to recover the user selection(s):

NamesDefaultToHere(1);

trailingSpaces =

Function({inList}, {DefaultLocal},

  outList = {};

  For(i=1, i<=NItems(inList), i++, InsertInto(outList, inList[i]||Repeat(" ", i)));

  outList;

);

listOfAs = {"aaa", "AAA", "AaA"};

New Window("Example", ListBox( trailingSpaces(listOfAs) ));


4 REPLIES
Solution

Maybe this is intended behaviour, but it looks more like a bug to me - Please do send an email to support@jmp.com which is one way into the formal Tech Support system.

As a workaround you could try the approach below. Depending on details, you may also need 'Trim()' to recover the user selection(s):

NamesDefaultToHere(1);

trailingSpaces =

Function({inList}, {DefaultLocal},

  outList = {};

  For(i=1, i<=NItems(inList), i++, InsertInto(outList, inList[i]||Repeat(" ", i)));

  outList;

);

listOfAs = {"aaa", "AAA", "AaA"};

New Window("Example", ListBox( trailingSpaces(listOfAs) ));


pmroz

Super User

Joined:

Jun 23, 2011

I had to do something similar, so I prefaced every entry with a number.  When it comes time to use the selection, strip off the number using WORDS or SUBSTR.

list = {"1. AAA","2. aaa","3. AaA","4. AAa","5. aaA"};

New Window("Example", ListBox( list ));

msharp

Super User

Joined:

Jul 28, 2015

Thanks guys, I was using a solution similar to PMroz using an associative array before and after to to fix the list. WORDS or SUBSTR, always tended to have issues if the data set was complex.  However, I've replaced the number list with the trailingSpaces script above which helps reduce clutter in the UI.  Thanks for the idea.

Additional info:

I reported this to tech support and they have responded saying this was an unexpected use of the list box() function and they are going to have it fixed in future versions. Here's to hoping it will make it to patch 12.2.

Wendy_Murphrey

Joined:

Jun 23, 2011

Just to clarify, I agree that this looks like a case that was not considered.  The issue has been reported to the JMP Development team for consideration in a future release of JMP. As this behavior has been in place for many releases, the development team must carefully consider making such a change due to possible effects on existing scripts. 

Kind regards,

Wendy

Wendy