Batch List

75 views
Skip to first unread message

ChUzEk

unread,
Dec 17, 2009, 9:49:07 AM12/17/09
to PHRETS
I imagine the batch processing script (http://troda.com/projects/
phrets/index.php?title=Create_batch_list) was designed to pass a list
of variables for querying fields that do not accept ranges (i.e.,
ListingKey, ListingID, etc.).

I wanted to know what the maximum number of variables that typically
can be sent for querying a particular field as imposed by most MLSs?
The script is great, but I'd like to make the batches as large as
possible.

Thanks!

Kevin

unread,
Dec 17, 2009, 9:51:59 AM12/17/09
to PHRETS
Can someone explain exactly what create_batch_list would be used for
an an practical example of its use?

Troy Davisson

unread,
Dec 17, 2009, 11:52:01 AM12/17/09
to phr...@googlegroups.com
It's original purpose was for GetObject but it can certainly be used for that as well.  I may modify the function to accept a delimiter value so it could be used for other things as well.

I'm not aware of any specific limit other than PHRETS using HTTP GET requests so you'd be limited to the number of characters allowed in a URL (which is something like 2,000 I believe).  Having PHRETS adjust to making HTTP POST requests is something I've wanted to add but haven't been able to justify the time for it yet since it works pretty well as it is.





--

You received this message because you are subscribed to the Google Groups "PHRETS" group.
To post to this group, send email to phr...@googlegroups.com.
To unsubscribe from this group, send email to phrets+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phrets?hl=en.



Troy Davisson

unread,
Dec 17, 2009, 12:00:02 PM12/17/09
to phr...@googlegroups.com
There's a small code example here: http://groups.google.com/group/phrets/msg/d16570387c3a2cb0?hl=en

but basically, imagine running an operation that just determined that there are 50 listings you need to retrieve updated photos for.  Normally, you might have an array of 50 individual MLS#'s that you need to retrieve.  You'd loop through that list like:

foreach ($listings_to_get as $listing) {
     $photos = $rets->GetObject("Property", "Photo", $listing);
     // then loop through the $photos to process each
}

When you use something like create_batch_list, you'd use a very similar loop:

$batches_to_get = create_batch_list($listings_to_get, 10);
foreach ($batches_to_get as $batch) {
     $photos = $rets->GetObject("Property", "Photo", $batch);
     // then loop through the $photos to process each
}

The 1 additional line for create_batch_list in the 2nd loop breaks your 50 item array into chunks of 10 items each.  If you had 50 items to grab total, the first loop makes 50 individual GetObject requests.  In the second example, it makes 5 GetObject requests total (each containing a request for 10 properties worth of photos).


Reply all
Reply to author
Forward
0 new messages