This topic is locked

Report : adding date range

9/26/2007 3:00:57 PM
PHPRunner General questions
H
hkopper author

I'm trying to insert the date range selected within the search portion of a report and display it in the actual report with the results.

J
Jane 9/27/2007

Hi,
you can do it using custom event on the report page:

  • add new custom event on the report page on the Visual Editor tab (Insert PHP code snippet option),
  • add your code in it.

    Here is a sample:
    global $strTableName;

    echo "Date range: "

    echo date("F j, Y", $_SESSION[$strTableName."_asearchfor"]["DateField"]);

    echo " - ";

    echo date("F j, Y", $_SESSION[$strTableName."_asearchfor2"]["DateField"]);

H
hkopper author 10/1/2007

Tried adding the sample code to the report but I keep getting a blank white screen.

Hi,

you can do it using custom event on the report page:

  • add new custom event on the report page on the Visual Editor tab (Insert PHP code snippet option),
  • add your code in it.

    Here is a sample:

J
Jane 10/2/2007

Hi,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and post a URL to your pages here or send it to [email=support@xlinesoft.com]support@xlinesoft.com[/email] along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

paperhog 10/31/2007

Hi,

you can do it using custom event on the report page:

  • add new custom event on the report page on the Visual Editor tab (Insert PHP code snippet option),
  • add your code in it.

    Here is a sample:


Using the same features but have one problem my date is stored as 2007-09-01

so I get

"A non well formed numeric value encountered"
What change do I need to make? I tried yyyy-mm-dd, which is how it is stored.
global $strTableName;
echo "Date range: ";

echo date("yyyy-mm-dd", $_SESSION[$strTableName."_asearchfor"]["job_post_date"]);

echo " - ";

echo date("yyyy-mm-dd", $_SESSION[$strTableName."_asearchfor2"]["job_post_date"]);

J
Jane 11/1/2007

Lori,
sorry for my fault.

Here is the correct code:

global $strTableName;

echo "Date range: ";

echo date("yyyy-mm-dd", strtotime($_SESSION[$strTableName."_asearchfor"]["job_post_date"]));

echo " - ";

echo date("yyyy-mm-dd", strtotime($_SESSION[$strTableName."_asearchfor2"]["job_post_date"]));

paperhog 11/1/2007

For anyone followinf this thread This is the solution that worked for my project.

function misc_Jobs_Event1(&$params)

{

global $strTableName,$daterange;

$daterange = $_SESSION[$strTableName."_asearchfor"]["job_post_date"];
if (isset ($daterange)){
echo "Date range: ";
echo date("F d, Y", strtotime($_SESSION[$strTableName."_asearchfor"]["job_post_date"]));

echo " - ";

echo date("F d, Y", strtotime($_SESSION[$strTableName."_asearchfor2"]["job_post_date"]));

}
}



By entering this on the visual editor page this way the date range only shows when one is given on the advanced search page! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22875&image=1&table=forumreplies' class='bbc_emoticon' alt='B)' />
And then it reads as Date range: September 01, 2007 - September 29, 2007