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
Filter override
5 posts
• Page 1 of 1
Posts: 3
Joined: Thu Apr 15, 2010 5:24 am |
|
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 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 |
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 |
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 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 |
Got it thankyou!
|
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 3 guests