Hey all, I have a view where the number of records that are displayed are determined from the values of the row data, and this logic can't be coded into the sql.

Is there a hook or method I can use that is called as each row is read so I can determine if the result should continue to be read? Can I set it as unlimited rows and break reading the result set somehow?

I also want to populate a "more" link to start where I broke the stream, let me know if you have any tips. I expect this should be easy but I haven't explored it until I can get the problem above solved.

Thanks for any ideas on this.

Comments

blairCruz’s picture

I'm guessing this isn't possible, as the looping code doesn't call any other code in the loop, this, taken from the view.inc, line 778

this->result = array();
while ($item = db_fetch_object($result))
$this->result[] = $item
}

makes it pretty clear that no other code could be called while looping the results. I suppose I can add some hooks to call my code here. Anyone think of any ill affects in doing this?

dawehner’s picture

In views3 the sql query plugin is just one implementation.

There are examples of query plugins for many different systems like apachesolr, yql or twitter etc.
I guess this would be helpful for you as well.

kars-t’s picture

Priority: Minor » Normal
Status: Active » Fixed

Dear fellow Drupal enthusiasts,

this issue is now lasting for a very long time in the issue queue and was unfortunately never solved. As Drupal is a open source project everyone is helping on voluntary basis. So that this is was not solved is nothing personal and means no harm. But perhaps no one had time to deal with this issue, maybe it is too complex or did not pose the problem comprehensible.

But this issue is not the only one. There are thousands of issues on Drupal.org that have never been worked on or could not be processed. This means that we are building a wave that is unmanageable and just a problem for the Drupal project as a whole. Please help us keep the issue queue smaller and more manageable.

Please read again, "Making an issue report" and see if you can improve the issue. Test the problem with the current Core and modules. Maybe the problem doesn't exist anymore, is a duplicate or has even been solved within this issue but never closed.

Help can also be found for it on IRC and in the user groups.

In order this issue no longer remains, I put this issue to "fixed".

If there is new information, please re-open the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.