Filter override

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 3
Joined: Thu Apr 15, 2010 5:24 am
PostPosted: Thu Apr 15, 2010 5:29 am
We have some calendar entries that we want to be on display no matter what the filter is set to. Or at least for the all day events to act in this manner.

What is the best way of achieving this?

Thx
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Apr 15, 2010 6:21 am
Cool idea. Since Filters are basically "finds", you'll want to script find that always includes these special records. But, you only need this find to run if other filters have been applied. So, here is how to do it.

Edit the script "Apply Filter to Found Set" and find the Exit Loop If script step. Right BEFORE that, add two lines:

Set Field [ SampleEvents::YourField ; Your Criteria ]
New Record Request

Create one pair of lines like this for every criteria you wish exempted from filters.

That's it.

Now if you want to always include all day events (to exempt them from the filters), you'll need to add a calc to your events table. Call it EventIsALLDay and make the calculation equal to isempty ( YourTimeStartDField ). Then in the Set Field mentioned above, set this field to 1 like this:

Set Field [ SampleEvents:: EventIsALLDay ; "1" ]
New Record Request

Enjoy!
John Sindelar
SeedCode
Posts: 3
Joined: Thu Apr 15, 2010 5:24 am
PostPosted: Thu Apr 15, 2010 9:12 am
I think I have done what you said, I want it to always display entires with a blank resource, so I created a calc field to show a "1" when the resource field is blank, but it does not recognise any filters when I do this, here is the code with my bit in bold:

#The following loop tranforms return separated criteria (as you'd find in a checkbox) into separate requests.
Loop
Set Variable [ $c; Value:$c +1 ]
Set Field By Name [ Evaluate ( "$$sc_FilterField" & $sc_FilterNumber ); GetValue ( $$sc_FilterCriteria[$sc_FilterNumber] ;
$c ) ]
If [ $$sc_FilterOmit [ $sc_FilterNumber ] ]
Omit Record
End If
Set Field [ SampleEvents::Resource_Is_Empty; "1" ]
New Record/Request

Exit Loop If [ $c ≥ $sc_FiltersCountOfCriteria ]
New Record/Request
End Loop
Constrain Found Set [ ]
# > > trap for nothing found?


Should the above work?

thx
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Apr 15, 2010 9:39 am
Looks good except that you should have left the original New Record step there so it should look like this:

#The following loop tranforms return separated criteria (as you'd find in a checkbox) into separate requests.
Loop
Set Variable [ $c; Value:$c +1 ]
Set Field By Name [ Evaluate ( "$$sc_FilterField" & $sc_FilterNumber ); GetValue ( $$sc_FilterCriteria[$sc_FilterNumber] ;
$c ) ]
If [ $$sc_FilterOmit [ $sc_FilterNumber ] ]
Omit Record
End If
New Record/Request
Set Field [ SampleEvents::Resource_Is_Empty; "1" ]
New Record/Request
Exit Loop If [ $c ≥ $sc_FiltersCountOfCriteria ]
New Record/Request
End Loop
Constrain Found Set [ ]
# > > trap for nothing found?
John Sindelar
SeedCode
Posts: 3
Joined: Thu Apr 15, 2010 5:24 am
PostPosted: Thu Apr 15, 2010 9:50 am
Got it thankyou!

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 2 guests

(855) SEEDCODE
[email protected]
Follow us: