Rob's TIMSS Blog

My discoveries and ramblings of TIMSS/Personify.

Thursday, April 20, 2006

TIMSS 6: Ad-Hoc & Search Operators

I was inspired by Susannah 's WebEx on Ad-hoc Queries today. When looking at the Advanced Query in Ad-Hoc or the Search screen, there are several operators you can use. Below is a listing of them and how to use them.



OperatorDescriptionExample Data
BTBetween 2 values, separated by commas (no space)1/1/2005,1/31/2005 (e.g. date between, and including, 1/1/2005 and 1/31/2005 )
ENDSEnds with entered textNON (e.g. customer class ends with NON)
EQEquals (=)VA (e.g. state equals VA)
GTGreater than (>)12/31/2004 (e.g. date is greater than 12/31/2004)
GTEGreater than or equal to (>=)12/31/2004 (e.g. date is greater than or equal to 12/31/2004)
HASData as entered text in itCouncil (e.g. Name has the word Council in it)
INIn list of values, separated by commas (no spaces)MD,DC,VA (e.g. State is either MD, DC, VA)
LTLess than (<)12/31/2004 (e.g. date is less than 12/31/2004)
LTELess than or equal to (<=)12/31/2004 (e.g. date is less than or equal to 12/31/2004)
NOT INNot in list of values, separated by commas (no spaces)MD,DC,VA (e.g. State is other than MD, DC, VA; and not missing)
NOTEQNot equal toVA (e.g. state other than VA; and not missing)
NOTNULLNot missingno data needed (e.g. email is not missing)
NULLMissingno data needed (e.g. email is missing)
STARTSStarts with entered textCOR (e.g. customer class starts with COR)
LT OR NULLLess than or missing12/31/2004 (e.g. date is less than 12/31/2004 or date is missing)
GT OR NULLGreater than or missing12/31/2004 (e.g. date is greater than 12/31/2004 or date is missing)




When you setup the Ad-Hoc Metadata (META001), you can choose a default operator. The important thing to note here is that this is not only what will be defaulted on the Advanced Query tab, but is also the operator that is used on the Simple Query tab. If you are searching on the Simple Query tab and are unsure what the default operator is, click over to the Advanced Query tab and see what it is set to.

Here are 2 update statements to set the default operator to Starts With for views you've already added (starting with USR_) and queries you've saved (where a value isn't already defined). They only update those that are String values, not Date or Nuemeric.

begin tran
update meta_query_view_column
set operator_code='STARTS'
where view_name like 'USR_%'
and datatype_code='S'
rollback tran

begin tran
update meta_saved_query_detail
set operator_code='STARTS'
where (filter_data is null or operator_code not in ('NULL','NOTNULL'))
and exists (select 1 from meta_query_view_column c
where c.view_name=meta_saved_query_detail.view_name
and c.column_name=meta_saved_query_detail.column_name
and c.datatype_code='S')
rollback tran

Applies to: TIMSS6

0 Comments:

Post a Comment

<< Home