I want a query filter that will only show a portion of the entries in the database. I would also like to limit users to one choice. Here is example code that I have used in a previous post.
New SQL Query(
Version( 130 ), Connection( "JMP" ),
JMP Tables(
["SAT" => "$SAMPLE_DATA\SAT.jmp",
"SATByYear" => "$SAMPLE_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;
For example, what if I only want to show users Alaska, California, Hawaii, Oregon and Washington?
I can replace _AllRows_, with {"Alaska", "California", "Hawaii", "Oregon", "Washington"}. However, that still shows all of the states. It just preselects the 5 states in the list.
My real application is a big DB with multiple filters, so I don't want to use intermediate tables.
Also, I would like to allow users to only select one state. Is it possible? I can change the filter type.