Access the Recordset for customize export

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
omegat
User
Posts: 24

Access the Recordset for customize export

Post by omegat »

Hi all

How to get the recordset from list page. I followed from
Connecting to MS ACCESS? http://www.hkvforums.com/viewtopic.php? ... ord#p77489
Access the Export-Recordset http://www.hkvforums.com/viewtopic.php? ... ted#p79138
add action button near export, print, ecc http://www.hkvforums.com/viewtopic.php?f=4&t=27074

by using code as below for function LoadRecordSet in Tablelist.php and function Recordset_Selected in Tableinfo.php After that can not get records and data shown in list page disappear.

function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn;
// Call Recordset Selecting event
$this->Recordset_Selecting($this->CurrentFilter);
// Load List page SQL
$sSql = $this->SelectSQL();
// Load recordset
$rs = ew_LoadRecordset($sSql);
if ($rs->RecordCount() > 0) { // If data found
$rs->MoveFirst(); // move to first record
while ($rs && !$rs->EOF) { // loop through the recordset
// Displaying the data
echo $rs->fields("WorkDate") . " ";
echo $rs->fields("Name") . " ";
echo $rs->fields("TimeIn") . " ";
echo $rs->fields("TimeOut") . " ";
echo $rs->fields("ABSENCE_NO") . " ";
echo $rs->fields("DOCUMENT_NO") . " ";
echo $rs->fields("Remark") . "<br>";
$rs->MoveNext(); // move to next record until EOF
}
$rs->Close(); // close the recordset after finished
} else { // if no data found
echo "No data found.";
}
}

function Recordset_Selected(&$rs) {
global $conn;
if ($rs->RecordCount() > 0) { // If data found
$rs->MoveFirst(); // move to first record
while ($rs && !$rs->EOF) { // loop through the recordset
// Displaying the data
echo $rs->WorkDate . " ";
echo $rs->Name . " ";
echo $rs->TimeIn . " ";
echo $rs->TimeOut . " ";
echo $rs->ABSENCE_NO . " ";
echo $rs->DOCUMENT_NO . " ";
echo $rs->Remark . "<br>";
$rs->MoveNext(); // move to next record until EOF
}
$rs->Close(); // close the recordset after finished
}
}

Thank you very much for the advice.


mobhar
User
Posts: 11736

Post by mobhar »

omegat wrote:
by using code as below for function LoadRecordSet in Tablelist.php and function Recordset_Selected
in Tableinfo.php After that can not get records and data shown in list page disappear.

You should not modify the generated code in the generated script file, since this will cause the records in List page will disappear.

You may use the code in this post for your best practice: viewtopic.php?f=4&t=26932&p=77489#p77489


omegat
User
Posts: 24

Post by omegat »

Thanks mobhar.

I have some question for more information.

  1. What file must to include for new practice?
  2. What is the EOF?
  3. Is there way to get value from external search in list page?

Thank you very much.


mobhar
User
Posts: 11736

Post by mobhar »

  1. Put that code in the generated "blankpage.php" file for best practice. Read "Generate a blank page" under "Generate Settings" in the help file for more information.
  2. EOF stands for "End Of File"; it is the terminology to explain the end of Recordset.
  3. What kind of value do you want to get? An example would be fine to comprehend the issue.

omegat
User
Posts: 24

Post by omegat »

Dear mobhar.
Thank you so much for your advice.

I can get all the records from blankpage.php and I would like to get records from list page after search finished.
And previous question (No.2),I mean value from external serch form in list page. How to send that value for criteria of sql query ($sql) in blankpage.php.

Thank you.
(^_^)


omegat
User
Posts: 24

Post by omegat »

Sorry for above reply, previous question = 3
omegat wrote:

  1. Is there way to get value from external search in list page?

and my code in blankpage.php as below

$sql = "SELECT * FROM Attendance3 WHERE Department = '9711021' AND WorkDate = '2014-06-05 0:00:00' ORDER BY TimeIn";
$rs = ew_Execute($sql);
if ($rs && $rs->RecordCount() > 0) { // If data found
$sFields = "";
$seq = 1;
$rs->MoveFirst(); // move to first record
while ($rs && !$rs->EOF) { // loop through the recordset
// Displaying the data
echo $seq . ". ";
echo $sFields = $rs->fields("WorkDate") . " ";
echo $sFields = $rs->fields("Name") . " ";
echo $sFields = $rs->fields("TimeIn") . " ";
echo $sFields = $rs->fields("TimeOut") . " ";
echo $sFields = $rs->fields("ABSENCE_NO") . " ";
echo $sFields = $rs->fields("DOCUMENT_NO") . " ";
echo $sFields = $rs->fields("Remark") . "<br>";
$seq++;
$rs->MoveNext(); // move to next record until EOF
}
$rs->Close();
} else {
echo "No records found.";
}

How to send criteria value of field "Department, WorkDate" from external serch form to sql query $sql ?

Thank you.
(^_^)


mobhar
User
Posts: 11736

Post by mobhar »

Still not clear to me.

Could you please explain, what is the relationship among the following pages?

  • The List page,
  • The External Search in List page (explain in more detail about this), and
  • The blankpage itself

In addition, how the data will flow from one to another pages?


omegat
User
Posts: 24

Post by omegat »

Dear mobhar

I had the idea to bring the value obtained from searches in the list page. To send it into the document in pdf customize format.

Thanks and Sorry I'm not good at english.
(^_^)


mobhar
User
Posts: 11736

Post by mobhar »

It depends on how you get the value in the exported customized PDF format. Try to refer to the generated code how to export the Records in the List page into PDF file.


Post Reply