`
ABC: Dynamic filtering on browse 1998-08-08 -- Jerry Norman Newsgroups: comp.lang.clarion >I am using C4 with the ABC templates. I have a list box that displays >all employees to begin with. At the top of the list box (actually on >the window) I have two sets of radio buttons taht allows the user to >select All, Employees or Subcontractors (LOC:Type) and (second >selection) Active, Inactive, and Terminated (LOC:Status). When either >one of these options are changed the list box stays the same. > >In C4 with the Legacy templates when one of the options was selected I >would Set the filter variable (LOC:Type and LOC:Status) to the correct >value, ForceRefresh = True, Do RefreshWindow, and Select(?Browse:1). I >would put all of the necessary code in the Validate-Filter Routine to >process each record against the settings of the local variables. If the >filter was false I would exit out of the Validate-Filter Routine and the >record would not be displayed. If the filter was true the record would >be displayed. > >How do I accomplish this in C4 with the ABC templates. Or is there a >better way to do this? It took me a while to figure this out but here's what is working very well for me. I had problems getting the radio buttons to work (C4b bug?) so I created my own alternative using three checkboxes with icons. For each check box I have true value = 1 and false = 0. In the Accessed embed for each check box I have code like this: Loc:WhseNoFltBurl=0 !Unlatches this unselected "radio button" Loc:WhseNoFltFlue=0 !Unlatches this unselected "radio button" BRW3.ApplyFilter ThisWindow.Reset(1) In the ApplyFilter embed for the browse I am filtering I have the following code: IF Loc:WhseNoFltAll=1 THEN BRW3.SetFilter('','2WhseNo') END IF Loc:WhseNoFltFlue=1 THEN BRW3.SetFilter('BUS:WAREHOUSE_NO >= ''10000'' AND BUS:WAREHOUSE_NO <<= ''10999''','2WhseNo') END IF loc:WhseNoFltBurl=1 THEN BRW3.SetFilter('BUS:WAREHOUSE_NO > ''30999'' AND BUS:WAREHOUSE_NO << ''32000''','2WhseNo') END On this same browse I also have two other standard check boxes for additional filters, Xplore for changing sort order and Query Wizard for additional adhoc queries. Using this technique they all work together perfectly in any combination. I also use GETINI and PUTINI to persist the filter settings between sessions. HTH. Printed November 23, 2024, 2:08 am This article has been viewed/printed 35392 times. Google search has resulted in 34 hits on this article since January 25, 2004. |