Jump to content

Filtering based on start date and end date


madman411

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

Recommended Posts

Hi all

I have two portals on a layout displaying two different sets of information. One displays records that have a return date matching the system date, and one displays records that have a start date matching the system date.

The portals are on a layout that references the same table, so I have set up a self join with my booking table. The filter calculation is simply:

Bookings2::Start-date = get(currentdate)

And bookings2::end-date = get(currentdate) for each portal respectively.

Thing is, the portals display no records. Is my calculation too simple?

Link to comment
Share on other sites

I comment. 

 

I figured out where I messed up. I had to create an additional SJ relationship and matched the record ID's with the cartesian join symbol. Seems my original two SJ relationships weren't set up correctly to return the proper information.

Link to comment
Share on other sites

You should try and narrow down the related set as much as possible before applying portal filtering. Relationship predicates are more efficient than portal filtering, since they look at pre-indexed data, while the portal filter has to calculate in real time.
 

Link to comment
Share on other sites

Listen to Comment here ... using a Cartesian product (X join symbol) relates ALL records to the current record and is very resource-expensive.  To first relate to ALL records and then to use portal filter to narrow the results would be wrong approach.

Link to comment
Share on other sites

This might be wise. I have about 22,000 records that need to be checked, though on average the most that would be actively "going out" or "returning" would be about 100.

Would two different TOs be necessary? Such as, one TO to reference outgoing items and another for returning?

Link to comment
Share on other sites

22k records is way too much for portal filtering, IMHO. To save on TOs, you could define a calculation field (result is Date, number of repetitions is 2) =

Extend ( Choose ( Get ( CalculationRepetitionNumber ) - 1 ; StartDate ; EndDate ) )

and use it as the matchfield opposite an unstored calc of Get(CurrentDate). This will reduce the related set to about 100, and you can then use portal filtering to split them up into outgoing and returning.

  • Like 1
Link to comment
Share on other sites

I figured you'd say that :)

To understand you a little better:

Create two calculation fields, one with two reps and the calc you supplied (calcdate) and one merely calculating today's date (currentdate). I'm assuming these would fall under my original TO of bookings.

When you say match field, are you referring to the way the existing TO is joined? So, bookings::datecalc = bookings4::currentdate?

Link to comment
Share on other sites

Yes, except the unstored calc needs to be on "this" side of the relationship - so something like:

 

Bookings::cToday = Bookings #::cBothDates

 

 

You could also use a global field instead of the current date calc and set it by script; that way you can peek at tomorrow's load, if you want.

Link to comment
Share on other sites

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