Jump to content
Server Maintenance This Week. ×

Basic Portal Filtering


mr_vodka

This topic is 3072 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 1 year later...
  • 2 years later...
  • Newbies

Hi John,

 

Thanks so much for this sample file! Very helpful! :)

 

Just wondering, could this method work to filter the portal by two different variables? I haven't quite unpacked exactly how it all works, but say if I wanted to be able to filter by both "Type = Bonus" and optionally ALSO say "Amt > 100". Would that be possible?

 

Thanks!!

John

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hi mr_vodka,

 

Just trying to understand the components of your example.

 

I gather the 3 scripts are aimed at resetting the sort filter criteria to "All" in each of the 3 different scenarios during navigation.

 

The sort filter calculation applied to the portal:

Parent::gSelect = "All" or Parent::gSelect = Child_FMP11::Type

 

….is the one I don't quite get, presuming this is what the portal uses to determine what the sort filter criteria are (based on the gSelect value).

 

Would you mind elaborating on how this calculation works to produce a sort filter for anything other than  an "All" value in gSelect.

 

TIA

Edit: Changed 'sort' for Filter ("Filter" was always my question, brain locked onto 'sort' - doh! - Thanks BruceR) 

 

 

This is a very basic demo for portal filtering including an "All" option for those that have asked backchannel.



* Edit - made a modification to file.

Link to comment
Share on other sites

It isn't a sort.

 

It's a filter.

 

For every record in the relationship defined for the portal; only display the record if its TYPE = gSelect

Link to comment
Share on other sites

Thanks BruceR,

 

Corrected my sloppiness - was always thinking filter!

 

As for the calculation, in my limited experience, I haven't come across one set out like that before;

 

Is that similar in function to an "If….Else" calculation? Could such an expression be used instead here?

 

 

It isn't a sort.

 

It's a filter.

 

For every record in the relationship defined for the portal; only display the record if its TYPE = gSelect

Link to comment
Share on other sites

Is that similar in function to an "If….Else" calculation?

 

The If() function has this structure:

If ( test ; result1 ; result2 )

The test expression is evaluated first for being true or false, then the appropriate result is calculated and returned.

 

 

When filtering a portal, you only need to supply the test expression: if it evaluates to true, the record is shown, otherwise it's not. IOW, filtering a portal by =

Parent::gType = Child::Type

is equivalent to saying:

 

If ( Parent::gType = Child::Type ; show this record ; do not show it )

Link to comment
Share on other sites

 

The test expression is evaluated first for being true or false, then the appropriate result is calculated and returned…….

 

 

When filtering a portal, you only need to supply the test expression: if it evaluates to true, the record is shown, otherwise it's not. IOW, filtering a portal by =……..

 

Thanks for your post Comment - love your work!

 

OK bear with me on this……..

 

I now understand the second part of the expression in the calculation:

 

Parent::gSelect = Child_FMP11::Type

 

​……..will only show those records in the portal whose field Child_FMP11::Type matches the currently selected value of Parent::gSelect.

 

The first 'test' in the equation;

 

Parent::gSelect = "All" 

 

​……I don't understand just yet. It looks like it's just trying to match the Parent::gSelect field with the string "All", and not compare it to the content of another field, as in the second part of the equation (which then defined the filter). Or is this expression effectively saying, "if the value in the field Parent::gSelect is equal to 'All', then the expression is true, and as no other field-based filter is specified, then all records are shown?

 

The next component I need to clarify is 'or'.

 

Does this operator become engaged by the calculation only when the preceding test returns a 'false'? (I haven't used 'or' in calculations before, so be gentle!) If so, does that mean that it's possible for several 'or' operators to follow each other within a single calculation, based on the notion of "if this test is false, go to the next expression in the calculation…….and if that test proves false, go to the next expression….etc..(where each test is separated by an 'or' operator).

 

TIA

Link to comment
Share on other sites

"if the value in the field Parent::gSelect is equal to 'All', then the expression is true, and as no other field-based filter is specified, then all records are shown?

 

Yes, that's exactly how it works. There is no rule that the test must examine some attribute of the child record (though usually that is the case). Of course, when it doesn't, the result will be applied to all child records without exception - which is the intended outcome in this example.

 

 

 

does that mean that it's possible for several 'or' operators to follow each other within a single calculation, based on the notion of "if this test is false, go to the next expression in the calculation……

 

Yes. I am not sure about the exact order of evaluation (though I believe it's from left to right, just as you described). The gist of it is that if at least one of the conditions returns true, the entire expression is true. IOW, all conditions must return false in order for the expression to return false.

 

See also:

http://www.filemaker.com/13help/en/html/non_toc.46.40.html#1029464

Link to comment
Share on other sites

Thankyou comment for your help clarifying this. Much appreciated as always.

 

 

 

 

Yes, that's exactly how it works. There is no rule that the test must examine some attribute of the child record (though usually that is the case). Of course, when it doesn't, the result will be applied to all child records without exception - which is the intended outcome in this example.

 

 

 

 

Yes. I am not sure about the exact order of evaluation (though I believe it's from left to right, just as you described). The gist of it is that if at least one of the conditions returns true, the entire expression is true. IOW, all conditions must return false in order for the expression to return false.

 

See also:

http://www.filemaker.com/13help/en/html/non_toc.46.40.html#1029464

Link to comment
Share on other sites

To take portal filtering a step further;

 

The scenario I'd be using this would be to display a portal containing client invoices. In the supplied example, my filters here would be "All", "Balance = 0.00", "Balance > 0.00" - I've got that part figured now.

 

In addition though, I want to be able to (optionally) filter the invoices by date range - either on the 'unfiltered' invoice list, or when it is filtered.

 

I imagine the date filtering would be set up as a separate function, so that the user first sets the date range (if they in fact need to, i.e. is an optional filter), and then selects from a drop-down list (as in the supplied example) to filter for invoice balances.

 

If I've applied a date range filter, will the balance filter only filter the found records from the date filter, or will it override this, and perform the filter on all records, effectively cancelling the date range filter?

 

 

 

 

Yes. I am not sure about the exact order of evaluation (though I believe it's from left to right, just as you described). The gist of it is that if at least one of the conditions returns true, the entire expression is true. IOW, all conditions must return false in order for the expression to return false.

 

 

Link to comment
Share on other sites

  • 1 year later...

Hi:

Thanks, this simplified my filtering, before I had a Case(...) and had added a field to the child table which entered a 0 value upon creation of a new record; therefore my formula was if empty  cero field in child =0 (showed all) if not empty match name (showed one).

I used your formula and changed the "All" to "" (empty) and it works fine. It is a contacts database and filtering displays only the desired contact. Velue list of persons shows only related names.

I have 2 unsolved problems now:

a)Timestamp, when I enter a name to filter, I update parent so I no longer info. on when some "fixed" data was modified. It could be solved by adding an extra table with just 2 fields (Company Nick Name and person to look up). Company Nick Name handles relationships (and it is not easy to change it and ruin the relationships).

2) Cleaning the person to look up in the parent table upon exiting the record, so that the next person who sees the record finds a full list of persons. It can be done via a button but I would love to find a script trigger to do it  

 

Link to comment
Share on other sites

With regard to the first problem: you should be using a global field (on the parent side) for the filtering expression. This will not only prevent the parent record being modified, but - much more importantly - enable two users to apply different filters without obstructing each other.

I wasn't able to understand the second problem.

 

 

Edited by comment
Link to comment
Share on other sites

Hi Comment:

I changed the field to global on the parent side and filtering stopped working.

Changed it back to text field and it started working again.

I must be doing something wrong.

Suggestions are very welcome

Thanks

Carlos

 

Link to comment
Share on other sites

This topic is 3072 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.