CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [RESOLVED - ¿HOW TO FILTER THE RESULTS FROM A GRID BETWEEN TWO DATES?

Print topic Send  topic

Author Message
CodeChargeMVP

Posts: 473
Posted: 09/13/2010, 3:10 AM

Hello,

I´ve create this threat since CCS Forums doesn´t allow me to respond to that post:

May cause it´s too old, anyways it could be handly for some developers.

Here´s the solution:

http://forums.codecharge.com/posts.php?post_id=106385

Of course,all new solutions for this matter are welcome.

Thank you very much for your time.
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 09/15/2010, 3:35 AM

Well this matter is taking too long,

There´s a big problem:

As you know mysql only accept some kinds of date formats to save dates on his database:

There´re:

--->"AAAA-MM-DD"
"AA--MM-DD"
"AAAAMMDD"
"AAMMDD"

On the dbformat option from data object properties you can set the format which match
with the one I marked with an arrow, so this means than we´re able to record dates
on our mysql databse (Bravo CCS).

But ok, ¿What will happen when we want to filter a grid between two dates or easyer by one

concret date?

CCS forced us to use the SHORT DATE format (mm/dd/yy) and there´s no way to choose

other one, this means, than we´re not able to compare the dates saved on the database

with the ones than are into the filters, obviously you can´t compare this two dates:

01/09/2010-->search grid
2010-09-04--->database


So the grid always will return no values when trying to filter by dates

¿Any Suggestion?

Quote CodeChargeMVP:
Hello,

I´ve create this threat since CCS Forums doesn´t allow me to respond to that post:

May cause it´s too old, anyways it could be handly for some developers.

Here´s the solution:

http://forums.codecharge.com/posts.php?post_id=106385

Of course,all new solutions for this matter are welcome.

Thank you very much for your time.

_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 09/15/2010, 8:05 AM

CodeChargeMVP,
If your filter is based on a different date format then all you have to do is change the date format of one of the dates to match the other. There is a Mysql function that will do that for you ( date_format() ). Also, I have never run into this issue before. I have always been able to compare dates with the same format.
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 09/15/2010, 10:53 AM

Hello MamboBrown,

I think you didn´t read carefoully my first message,

please read it again, is not possible to match twice dates.

I´ve also try to create a new expression column with the

date_format function on the data source and than

filter the results from the grid by this new column expression

and it does not work.

Quote mamboBROWN:
CodeChargeMVP,
If your filter is based on a different date format then all you have to do is change the date format of one of the dates to match the other. There is a Mysql function that will do that for you ( date_format() ). Also, I have never run into this issue before. I have always been able to compare dates with the same format.

_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 09/15/2010, 2:08 PM

CodeChargeMVP,
Your right :-D, sometimes I glaze over the info.
In regards to your comment, I have created many filters based on different date formats (I formatted the dates to look the same) and it works just fine for me. CCS did not force me to use a preset date format. Here is an example: http://brofam.com/calendartask/task.php
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 09/22/2010, 9:53 AM

Hello mamboBROWN,

Thank you for your time,

By the way i´ve disabled the fields and will back over this issue on the right time.

I´ll study the function date format from common.php and see if it´s handle.

Quote mamboBROWN:
CodeChargeMVP,
Your right :-D, sometimes I glaze over the info.
In regards to your comment, I have created many filters based on different date formats (I formatted the dates to look the same) and it works just fine for me. CCS did not force me to use a preset date format. Here is an example: http://brofam.com/calendartask/task.php

_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 10/08/2010, 1:30 AM

I´m back over this issue and I´ve find this helpful thread:

http://forums.codecharge.com/posts.php?post_id=68575
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 10/22/2010, 9:56 AM

I´ve try to do this on the function show of the search grid

//FechaDesde
$JGFechaDesdeCadena = CCParseDate(CCGetFromGet("s_JGFechaDesde",NULL),array("dd","/","mm","/","yyyy"));
$JGFechaDesdeFormateada = CCFormatDate($JGFechaDesdeCadena,array("yyyy","-","mm","-","dd"));

//FechaHasta
$JGFechaHastaCadena = CCParseDate(CCGetFromGet("s_JGFechaHasta",NULL),array("dd","/","mm","/","yyyy"));
$JGFechaHastaFormateada = CCFormatDate($JGFechaHastaCadena,array("yyyy","-","mm","-","dd"));


$this->DataSource->Parameters["urls_JGFechaDesde"] =$JGFechaDesdeFormateada;
$this->DataSource->Parameters["urls_JGFechaHasta"] = $JGFechaHastaFormateada;


but it shows an error message which says the value at the field urls_JGFechaHasta is not valid use the next format:: ShortDate

then I´ve check out the code and i´m struggling about modifying this part: on the function prepare

$this->wp->AddParameter("14", "urls_JGFechaDesde", ccsDate, $DefaultDateFormat, $this->DateFormat, $this->Parameters["urls_JGFechaDesde"], "", false);


Any suggestion?
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 10/28/2010, 4:29 AM


CCParseDate returns an array value ¿why?

¿shouldn´t it return a date value?

$JGFechaDesde = CCGetFromGet("s_JGFechaDesde",NULL);
$JGFechaDesdeCadena = CCParseDate($JGFechaDesde,array("yyyy"," ","mm"," ","dd"));

echo($JGFechaDesdeCadena);
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 10/28/2010, 10:26 AM

I´ve resolve the issue :-D

The trick was to modify the parameters $Format and $DBFormat from the addparameter function

on the prepare function, then when both formats are equals, date can be compared and so

values retrieved and grid filled.
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.