Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression-based Search String in Select In Field Trigger

Qlikview newby here.  I have a trigger that is tied to the OnActivateSheet event.  It uses a "Select in Field" action that selects a value from a field (Location), but currently the search string is hard-coded.  Using the hard-coded search string, the trigger works as expected.  What I want to be able to do is write and expression that gets the first (alphabetically) Location in the data, rather than hard-code the search string.  So, if I have Locations A, B, and C, I want the expression to return A.  The next time the data is loaded, there may not be an A value in the data.  If the values are B, D, and E, I want the expression to return B.  I have tried a number of expressions to try to get the first value, but have not been successful.  I come from a background where functions like Min would normally return the value I'm looking for, but MIN seems to only apply numbers or dates in QlikView, and MinString seems to apply only in a chart context.  Any suggestions?

1 Solution

Accepted Solutions
oscar_ortiz
Partner - Specialist
Partner - Specialist

I do believe the MinString function will work.

On your OnActivateSheet trigger add the action "select in field".

For "Field" enter the field name for example "Field1"

For the "Search String" use: =MinString(Field1)

This should return the lowest available string for you.

Good luck

Oscar

View solution in original post

2 Replies
oscar_ortiz
Partner - Specialist
Partner - Specialist

I do believe the MinString function will work.

On your OnActivateSheet trigger add the action "select in field".

For "Field" enter the field name for example "Field1"

For the "Search String" use: =MinString(Field1)

This should return the lowest available string for you.

Good luck

Oscar

Not applicable
Author

Indeed, it did.  Thanks!  What confused me was that in order for hard-coding to work in the search string, you have enclose the string in parentheses (as in '(MyLocation)'), so I was creating the formula as ='(' & MinString(Location) & ')'.  However, just the formula =MinString(Location) works.  Again, thanks!