Max Rows Error?

131 views
Skip to first unread message

Tom Ashworth

unread,
Apr 16, 2015, 12:53:21 PM4/16/15
to phr...@googlegroups.com
Can't figure out why I am getting this error:

+ Property:A
+ Query: (L_UpdateDate=2015-04-01T00:00:00+) Limit: 1000 Offset: 1

Fatal error: Call to undefined method PHRETS\Session::IsMaxrowsReached() in E:\wamp\www\RETS\test_fetch.php on line 56


Here is my code (NOTE: config.php is my login info which is not shown)

<?php
require_once("vendor/autoload.php");

$log = new \Monolog\Logger('PHRETS');
$log->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG));

require_once("config.php");
$rets->setLogger($log);
$rets->Login();

$rets_modtimestamp_field = "L_UpdateDate";
$property_classes = array("A");
$previous_start_time = "2015-04-01T00:00:00";

foreach ($property_classes as $class) {

        echo "+ Property:{$class}<br>\n";

        $file_name = strtolower("property_{$class}.csv");
        $fh = fopen($file_name, "w+");

        $maxrows = true;
        $offset = 1;
        $limit = 1000;
        $fields_order = array();

        while ($maxrows) {

                $query = "({$rets_modtimestamp_field}={$previous_start_time}+)";

                // run RETS search
                echo "   + Query: {$query}  Limit: {$limit}  Offset: {$offset}<br>\n";
                $search = $rets->Search("Property", $class, $query, array('Limit' => $limit, 'Offset' => $offset, 'Format' => 'COMPACT-DECODED', 'Count' => 1));

                if ($search->getReturnedResultsCount() > 0) {

                        if ($offset == 1) {
                                // print filename headers as first line
                                $fields_order = $rets->SearchGetFields($search);
                                fputcsv($fh, $fields_order);
                        }

                        // process results
                        while ($record = $rets->FetchRow($search)) {
                                $this_record = array();
                                foreach ($fields_order as $fo) {
                                        $this_record[] = $record[$fo];
                                }
                                fputcsv($fh, $this_record);
                        }

                        $offset = ($offset + $rets->NumRows());

                }

                $maxrows = $rets->IsMaxrowsReached();
                echo "    + Total found: {$rets->NumRows()}<br>\n";

                $rets->FreeResult($search);
        }

        fclose($fh);

        echo "  - done<br>\n";

}

echo "+ Disconnecting<br>\n";
$rets->Disconnect();
?>

Tom Ashworth

unread,
Apr 16, 2015, 12:56:40 PM4/16/15
to phr...@googlegroups.com
I figured that out, my property class was RE_E

Now I am getting this error.

+ Property:RE_1

+ Query: (L_UpdateDate=2015-04-01T00:00:00+) Limit: 1000 Offset: 1

Fatal error: Call to undefined method PHRETS\Session::SearchGetFields() in E:\wamp\www\RETS\test_fetch.php on line 39




On Thursday, April 16, 2015 at 11:53:21 AM UTC-5, Tom Ashworth wrote:
Can't figure out why I am getting this error:

+ Property:A
+ Query: (L_UpdateDate=2015-04-01T00:00:00+) Limit: 1000 Offset: 1

Fatal error: Call to undefined method PHRETS\Session::IsMaxrowsReached() in E:\wamp\www\RETS\test_fetch.php on line 56


Here is my code (NOTE: config.php is my login info which is not shown)

<?php
require_once("vendor/autoload.php");

$log = new \Monolog\Logger('PHRETS');
$log->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG));

require_once("config.php");
$rets->setLogger($log);
$rets->Login();

$rets_modtimestamp_field = "L_UpdateDate";
$property_classes = array("RE_1");

Ryan R

unread,
Apr 17, 2015, 6:24:23 PM4/17/15
to phr...@googlegroups.com
Hey Tom,

It looks like you are mixing up PHRETS 1.x and 2.x API. SearchGetFields is from 1.x. You have to adjust it to some 2.x API somehow or another. I'm not entirely sure what that is because I just started messing with this thing.

Good luck!

Ryan

Tom Ashworth

unread,
Apr 17, 2015, 8:49:26 PM4/17/15
to phr...@googlegroups.com
Thanks Ryan,  I looked at api calls for 2.x in docs and it is there, so I am note sure what or how to fix this.  Any help would be appreciated.

Tom

Ryan

unread,
Apr 17, 2015, 8:59:08 PM4/17/15
to phr...@googlegroups.com
Those docs might be for 1.x and not updated yet. The only docs I've noticed for 2.x are in the README.md file.

There is a function mentioned in the README.md file in the 3rd box in this section: https://github.com/troydavisson/PHRETS/blob/master/README.md#user-content-processing-results

$record->getFields(); // return an array of the field names associated with this record


I also just use the Session.php file to scan which options there, I was actually converting a script form 1.x to 2.x by looking at some of the variables in the 1.x code and searching the 1.x phprets.php file and searching the same variables or parts or key values etc with in the Session.php file to compare which functions to use.
  • phrets\vendor\troydavisson\phrets\src\Session.php
My problem seems to be more that I can't get the records properly or something. Once I figure that out I will be done! Woohoo.


Thanks Ryan,  I looked at api calls for 2.x in docs and it is there, so I am note sure what or how to fix this.  Any help would be appreciated.

Tom
--
You received this message because you are subscribed to a topic in the Google Groups "PHRETS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phrets/Bss3Uac-OHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at http://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Tom Ashworth

unread,
Apr 21, 2015, 10:01:27 AM4/21/15
to phr...@googlegroups.com

I still have not figured this out... not sure what the correct query is, just trying to get started with 2.0. , so any help is appreciated.....

Troy Davisson

unread,
Apr 21, 2015, 4:55:42 PM4/21/15
to phr...@googlegroups.com

With version 2, you'd:

  1. Make your Configuration object
  2. Make your Session object
  3. Call Login
  4. Call Search which returns a Results object
  5. Call getFields() on the Results object to get the list of fields included in that search
Previously, all of the methods were called directly on the main PHRETS object.  That's been changed with the new version to provide more targeted, helpful methods for doing certain things in different contexts.

In the link Ryan pointed to, the $results variable is the Results object which is where you can call getFields()



--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages