Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderator: amosbatto

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.

I tried to fetch the data using the below api.
Get Report Table Data: GET project/{prj_uid}/report-table/{rep_uid}/data
Processmaker - 3.2.2

For 10000 records in Report table - Success.
But more than 10K records i am not able to fetch. Getting an error.

#1 Is there any limit to fetch the records in Report table using rest api.
#2 Is it possible to fetch the record based on parameters in report table.

Help me on this!!!

I don't have time to test this right now, so this might require a little debugging, but here are the basic changes that you need to make in the source code to limit the number of records from the Report Table.

Make backup copies of the files workflow/engine/src/ProcessMaker/Services/Api/Project/ReportTable.php and workflow/engine/src/ProcessMaker/BusinessModel/Table.php before you make any changes to them.

Edit workflow/engine/src/ProcessMaker/Services/Api/Project/ReportTable.php and change the definition of the doGetReportTableData() function starting on line 77 to:
Code: Select all
     * @param string $prj_uid {@min 1} {@max 32}
     * @param string $rep_uid {@min 1} {@max 32}
     * @param string $filter {@from query}
     * @param string $search {@from query}
     * @param int $start {@from query}
     * @param int $limit {@from query} 
     * @return array
     * @author Brayan Pereyra (Cochalo) <[email protected]>
     * @copyright Colosa - Bolivia
     * @url GET /:prj_uid/report-table/:rep_uid/data
    public function doGetReportTableData($prj_uid, $rep_uid, $filter = null, $search = '', $start = null, $limit = null)
        try {
            $oReportTable = new \ProcessMaker\BusinessModel\Table();
            //function getTableData($tab_uid, $pro_uid = '', $filter = null, $reportFlag = false, $search = '', $start = null, $limit = null)
            $response = $oReportTable->getTableData($rep_uid, $prj_uid, $filter, true, $search, $start, $limit);
            return $response;
        } catch (\Exception $e) {
            throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
Then, edit workflow/engine/src/ProcessMaker/BusinessModel/Table.php and change the definition of the getTableDate() function starting on line 142 to:
Code: Select all
     * Get data for Table
     * @var string $tab_uid. Uid for table
     * @var string $pro_uid. Uid for process
     * @var string $filter. String to search for in any field in the table
     * @var string $reportFlag. If is report table
     * @var string $search. JSON string of object with fields to search for. Ex: '{"where":{"FIELD1":"value1","FIELD2":"value2"}}'
     * @var int $start. Number of record in table where to start
     * @var int $limit. Number of records to return
     * @author Brayan Pereyra (Cochalo) <[email protected]>
     * @copyright Colosa - Bolivia
     * @return array
    public function getTableData($tab_uid, $pro_uid = '', $filter = null, $reportFlag = false, $search = '', $start = null, $limit = null)
        $inputFilter = new \InputFilter();
        $filter = $inputFilter->sanitizeInputValue($filter, 'nosql');

        if ($reportFlag) {
            $pro_uid = $this->validateProUid($pro_uid);
        $tab_uid = $this->validateTabUid($tab_uid, $reportFlag);

        $additionalTables = new AdditionalTables();
        $table  = $additionalTables->load($tab_uid, true);
        //getAllData($sUID, $start = null, $limit = null, $keyOrderUppercase = true, $filter = '', $appUid = false, $search = '')
        $result = $additionalTables->getAllData($tab_uid, $start, $limit, null, $filter, false, $search);
        $primaryKeys = $additionalTables->getPrimaryKeys();
        if (is_array($result['rows'])) {
            foreach ($result['rows'] as $i => $row) {
                $result['rows'][$i] = array_change_key_case($result['rows'][$i], CASE_LOWER);
                $primaryKeysValues = array ();
                foreach ($primaryKeys as $key) {
                    $primaryKeysValues[] = isset( $row[$key['FLD_NAME']] ) ? $row[$key['FLD_NAME']] : '';

                $result['rows'][$i]['__index__'] = G::encrypt( implode( ',', $primaryKeysValues ), 'pmtable' );
        } else {
            $result['rows'] = array();
        return $result;
Then you should be able to get rows from the Report Table by calling the endpoint multiple times like this:
GET project/1234567890abcde1234567890abcde/report-table/abcde1234567890abcde1234567890/data?limit=1000
GET project/1234567890abcde1234567890abcde/report-table/abcde1234567890abcde1234567890/data?start=1001&limit=1000
GET project/1234567890abcde1234567890abcde/report-table/abcde1234567890abcde1234567890/data?start=2001&limit=1000
GET project/1234567890abcde1234567890abcde/report-table/abcde1234567890abcde1234567890/data?start=3001&limit=1000

If this doesn't work, then post here what errors you are seeing and I will debug it when I find extra some time.

Another concern, I have a form that loads data fro[…]

Display PDF in Dynaform

Buenas tardes, Por favor necesito su apoyo con e[…]

Hi, I am trying to import users into PM from our […]

Hi amosbatto, this issue still present on 3.3.4-co[…]