
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Qliksense MinString function: How to find lowest alphabetic string ignoring case(case insensitive)?
Hi,
In our Qliksense app, we reply on the function MinString({1} [Dimension]) to find the first available value in a dimension in lowest alphabetic order, but there is a caveat to this solution. It seems Qliksense's string comparison with MinString/MaxString is case sensitive, and the upper case letters have lower ordinal values than lower case letters. For this reason, it appears 'A' < 'Z' and 'a' < 'z', but 'Z' < 'a'.
For instance, given a list of countries ValueList('Ukraine', 'Uruguay', 'USA', 'Uzbekistan'), we expect MinString will return Ukraine, but instead it returns USA, because uppercase letter 'S' appears to be lower than lowercase letter 'k'.
Is there a way to get around this limitation so we can get the first value from lowest alphabetic order with case insensitive string comparison? We tried to use lower() and upper(), but the results are undesirable as we cannot restore it back to the original string. Please help.
- Subscribe by Topic:
-
Data Model
-
General Question
-
Script and Expressions
-
Variables
-
Visualization
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are right, the expressions I gave you where designed to work with the current selections, but you could manipulate them to work with the full set (ignoring your selections).
In the screenshot I kept the original expressions, but in the second column the expressions ignores any selections made.
The SET analysis method
only({1<Country={"=only({1}Upper(Country))='$(=Minstring({1}upper(Country)))'"}>} Country)
The First Sorted Value method
FirstSortedValue({1}Country, Aggr(-Rank(only({1}Lower(Country))), Country))
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try to do MinString({1} upper([Dimension]) )
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This does not work, as we want it to return the lowest alphabetic value but as its original version, not as the uppercase version.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This would work I think.
=Pick(
WildMatch(
MinString(lower(ValueList('Ukraine', 'Uruguay', 'USA', 'Uzbekistan')))
,'Ukraine', 'Uruguay', 'USA', 'Uzbekistan')
,'Ukraine', 'Uruguay', 'USA', 'Uzbekistan')
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response, yes it works for this example. Though in real application, there is no ValueList and the data comes from a dimension. For instance, we may have a dimension like 'Countries', and then it becomes:
=Pick(WildMatch(MinString(Lower([Countries])), [Countries]), [Countries])
The issue though, is that we would like to display the value from MinString ignoring current selection(regardless of what values are currently being selected in dimension [Countries]). I tried something like this, and it does not work:
=Pick(WildMatch(MinString(Lower({1} [Countries])), {1} [Countries]), {1} [Countries])
Do you know if there is a way I can make Pick and WildMatch work ignoring current selections?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you load both the original case and UPPER() or LOWER() case in your original Load table, you should be able to do this with FieldIndex and FieldValue, I believe.
Of course, at this point it'd probably be easier to just add a row number field and use Min() on that, fetching the corresponding FieldValue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try finding the minstring using Firstsortedvalue(). This will return the desired country name in it its original case.
FirstSortedValue(Country, aggr(-Rank(lower(Country)), Country))
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could also do a set analysis approach, that will give you the desired country.
only({<
Country={"=Upper(Country)='$(=Minstring(upper(Country)))'"}
>} Country)
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The solutions you propose do work when no value from [Countries] are being selected, but stops working as soon as there is one value being selected. The idea is that we would like to find the MinString value ignoring current selections in the field.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure why it would stop working when a selection is made. Ultimately the order of countries is fixed, and the list of countries is fixed. You could just pre-sort your countries in use Dual(), for that matter, with the corresponding row number.

- « Previous Replies
-
- 1
- 2
- Next Replies »