Jump to content

Filtering records in a portal


Louisa

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

Recommended Posts

I would like to be able to filter out records in a portal so that only records which fit a certain criteria appear.

On a layout I need to have two portals displaying information from the same database. One portal needs to display records with a creation date prior to a given date (this is not fixed like today's date or something like this but is determined by the user) and those which were created on that date. I'm not to sure how to do this.

I've figured out how to display the ones which were created on that date by creating a global field which combines the master records ID with the date and relating the portal on this. Can I do something similar for the other portal?

Thanks

Link to comment
Share on other sites

quote:

Originally posted by Louisa:

I would like to be able to filter out records in a portal so that only records which fit a certain criteria appear.

On a layout I need to have two portals displaying information from the same database. One portal needs to display records with a creation date prior to a given date (this is not fixed like today's date or something like this but is determined by the user) and those which were created on that date. I'm not to sure how to do this.

Filtering by date is really problematic, since you have infinite variation in possible data. If it is not the specified date and not earlier there is still almost infinite variants of the possible dates that match.

I would recommend the following. The user specifys the desired date, then click a "Filter" button. Do a find in the related file for the date and all prior dates (i.e. DateField <= SpecifiedDate). Then do a replace on a flag field (FlagField = 1) and have your portal display records based on that flag.

This is kind of a hassle, but a good way to approach this problem.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Senior Filemaker Developer

http://www.database-resources.com

mailto:[email protected]

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

  • 4 weeks later...
  • Newbies

quote:

Originally posted by captkurt:

Filtering by date is really problematic, since you have infinite variation in possible data. If it is not the specified date and not earlier there is still almost infinite variants of the possible dates that match.

I would recommend the following. The user specifys the desired date, then click a "Filter" button. Do a find in the related file for the date and all prior dates (i.e. DateField <= SpecifiedDate). Then do a replace on a flag field (FlagField = 1) and have your portal display records based on that flag.

This is kind of a hassle, but a good way to approach this problem.


This solution will not work in a networked , shared solution will it? Won't everyone's portals change when one person changes the relationship criteria?

Link to comment
Share on other sites

quote:

Originally posted by slemson:

This solution will not work in a networked , shared solution will it? Won't everyone's portals change when one person changes the relationship criteria?

Hmm, good point. The only other solution is some kind of calculated multikey. You could either use specific dates, or calculate ranges (Past, Last Week, This Week, This Month, This Year, Future, etc) which is easier to do, but less precise.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Senior Filemaker Developer

http://www.database-resources.com

mailto:[email protected]

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

If I'm not mistaken, you can get around the fact that the technique with the relationship based on the calculation not working by appending to the fields on both sides a global field that is unique to each user. The easiest way I can think to do this is to have a field gCurrent_User and set it in your open script to Status( CurrentUserName).

On the other side of the relationship, have some mechanism to keep a return deliminated list of the current users that need to be related to each record. The right side field in the relationship would have data like this:

1Chuck Ross

1Joe Smith

1Mike Jones

The left side would be a calculation something like this:

NumToText( Date1<=Date2 ) & gCurrent_User

That way, this calculation field will be unique for each user on the network. If the calculation results in 1Mike Jones, it will be related to the record with a field like the one above.

The only thing you need to figure out is how to get the return deliminated list to have the proper values. I'm not positive that this will work, but it's worth a shot.

Chuck

Link to comment
Share on other sites

This topic is 8647 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.