/* Copyright(c) 1995 by SAS Institute Inc., Cary, NC USA */ length wherecls $200 type $1; /* Set up the event handler for the data table. We want */ /* to handle the TABLE_WHERE_CHANGE event and subset the */ /* data set using a WHERE clause. */ init: method; call super(_self_,'_INIT_'); call send(_self_,'_SET_EVENT_HANDLER_','*', 'TABLE_WHERE_DATA','NEW_WHERE',_self_); endmethod; /* Get the name and type of the variable to use for the */ /* WHERE clause. */ wherecol: method name $8; wherecol=name; call send(_self_,'_GET_COLUMN_NUMBER_',name,id); templst=makelist(2); templst=setnitemn(templst,id,'COLUMN_NUMBER'); templst=setnitemc(templst,' ','TYPE'); call send(_self_,'_GET_COLUMN_ATTRIBUTES_',templst); type = getnitemc(templst,'TYPE'); if type='C' then wherequote='"'; rc=dellist(templst); endmethod; /* Get the operator to use for the WHERE clause. */ whereop: method operator $ 20; whereop=operator; endmethod; /* Get the ending text to use for the WHERE clause. */ whereend: method endtext $ 20; whereend=endtext; endmethod; /* Get the preceding text to use for the WHERE clause. */ wherepre: method pretext $ 20; wherepre=pretext; endmethod; /* Apply the WHERE clause based on information sent in */ /* the event. */ newwhere: method text $200; if wherecol^=' ' and whereop^=' ' then do; wherelst=makelist(1); wherecls=wherecol || ' ' || whereop || ' '; if wherequote^=' ' then wherecls=wherecls || wherequote; if wherepre^=' ' then wherecls=wherecls || wherepre; wherecls=wherecls || text; if whereend^=' ' then wherecls=wherecls || whereend; if wherequote^=' ' then wherecls=wherecls || wherequote; rc=setnitemc(wherelst,wherecls,'WHERE_CLAUSE'); /* Set the WHERE clause on the data table. */ call send(_self_,'_SET_WHERE_',wherelst); rc = dellist(wherelst); end; endmethod;