I want to have a query where, if users do not select anything, then an empty list is returned. Here is an example modified from the following JMP Query Builder page.
https://www.jmp.com/support/help/14/query-and-join-data-tables-with-jmp-query-builde.shtml
Rather than filtering by scores, as on the web page, I modified it so users select states. When no states are selected, then I want an empty list or table returned.
New SQL Query(
Version( 130 ), Connection( "JMP" ),
JMP Tables(
["SAT" => "\C:\Program Files\SAS\JMPPRO\14\Samples\Data\SAT.jmp",
"SATByYear" => "\C:\Program Files\SAS\JMPPRO\14\Samples\Data\SATByYear.jmp"]
),
QueryName( "SATQuery" ),
Select( Distinct,
Column( "State", "t1" ),
Column( "% Taking (2004)", "t1" ),
Column( "2004 Verbal", "t2" ),
Column( "2004 Math", "t2" )
),
From(
Table( "SATByYear", Alias( "t1" ) ),
Table( "SAT", Alias( "t2" ),
Join( Type( Left Outer ),
EQ( Column( "State", "t1" ), Column( "State", "t2" ) ) &
EQ( Column( "% Taking (2004)", "t1" ),
Column( "% Taking (2004)", "t2" ) )
& EQ( Column( "X", "t1" ), Column( "X", "t2" ) )
& EQ( Column( "Y", "t1" ), Column( "Y", "t2" ) )
& EQ( Column( "Population", "t1" ), Column( "Population", "t2" ) )
& EQ( Column( "Latitude", "t1" ), Column( "Latitude", "t2" ) )
& EQ( Column( "Longitude", "t1" ), Column( "Longitude", "t2" ) )
)
)
),
Where(
In List( Column( "State", "t1" ),
_AllRows_,
UI( SelectListFilter(
ListBox,
Base( "Categorical",
Prompt( "State:", Character, PromptName( "t1.State_1" ),
ValueSource( Column( "State", Alias( "State" ), Table( "SATByYear" ) ) )
)
)
)
)
)
)
) << Run;
If it is possible, I think it would happen the the Where clause. I have tried Not In List, Not Or, and replacing _AllRows_ with an empty list, {}. Whatever I do, if no states are selected from the list box, then all states are returned, or I get an error.
We are designing an app with several list boxes filtering choices for a SQL query. Some list boxes will have hundreds of choices. A Manual List is not good, because users will not know all of the choices. For our purposes, when no items are selected, it will be preferable to have an empty list returned. Is this possible? If so, can it be demonstrated with the SAT example I posted above?
Thanks for any suggestions or insights.