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 -> Java

 hi

Print topic Send  topic

Author Message
ramareddypalla

Posts: 8
Posted: 06/08/2004, 2:15 AM

hi,

can any one me tell how to retrive the data between two dates in jsp. I am getting an error "No row count was produced".
View profile  Send private message
bhavaniprasad

Posts: 2
Posted: 06/09/2004, 7:29 AM

Do you want to query between two dates or what?
More clarity required.

-- Bhavani Prasad.
View profile  Send private message
ramareddypalla

Posts: 8
Posted: 06/09/2004, 9:43 PM

Quote bhavaniprasad:
Do you want to query between two dates or what?
More clarity required.

-- Bhavani Prasad.
hi Bhavani Prasad,
Thanks for u r repluy

My query is

Select * from table where date between to_date('01/01/04','dd/mm/yy') and to_date('02/01/04','dd/mm/yy');

But this is query is giving error .
View profile  Send private message
Anton
Posted: 06/15/2004, 1:54 AM

// Event BeforeExecuteSelect Action Custom Code ....
// Example of a day range based upon today...
// Adapt to your needs.

int agerangemin, agerangemax;
agerangemin = 0;
agerangemax = 0;

java.util.Calendar calFrom = Calendar.getInstance();
java.util.Calendar calTo = Calendar.getInstance();

// Do what you want with Calendar objects...
calFrom.add(Calendar.DAY_OF_MONTH,-agerangemax);
calTo.add(Calendar.DAY_OF_MONTH,-agerangemin);
// eo: Do what you want with Calendar objects

e.setWhere( ((e.getWhere() == null || "".equals(e.getWhere().trim())) ? "" : e.getWhere()+" AND ")+
"yourdatefld BETWEEN "+
DBTools.toSql(calFrom.getTime(),"YOURDB")+
" AND "+DBTools.toSql(calTo.getTime(),"YOURDB"));

I assume that 'date' is NOT a real column name. Some databases (Visual FoxPro) allow 'date' as a field column name and 'table' as a table name - terrifying & GPFing !

The use of DBTools.toSql(....,"YOURDB") keeps you portable between DBs.

Regards

Anton
ramareddypalla

Posts: 8
Posted: 06/20/2004, 9:46 PM

hi Anton,
Thanks for u r reply. This code is working great.

regards
ramareddypalla
View profile  Send private message
Anton Hinxman
Posted: 06/24/2004, 4:06 AM

And as a bonus here is the code to rid yourself of the CCS date picker and use a JavaScript date picker capable of international dates via a calendar date picker popup.

1. You need the Javascript: http://myweb.tiscali.co.uk/webapps/popcalendar.js
2. Place a hidden textbox with normal date based column association
3. Invoke a before show method: <Your utility class object>.makeDateCalendarButton(e.getControl(),"Your Date Desc");

Place this code in you utility class:

/* Make date calendar from hidden control
* @param hiddenDateCtrl Hidden CCS control containing date
* @param forPrompt Prompt for clear of date
* @param futureonly Calendar option for no choice of past dates
*/
public void makeDateCalendarButton(Control hiddenDateCtrl, String forPrompt, boolean futureonly) {
if(hiddenDateCtrl instanceof Control
&& hiddenDateCtrl.getParent() != null
&& hiddenDateCtrl.isVisible()) {
if(forPrompt == null) forPrompt = "";
String dateTxtPrompt = hiddenDateCtrl.getFormattedValue();
if("".equals(dateTxtPrompt)) dateTxtPrompt = "(empty)";
hiddenDateCtrl.setFormattedValue(hiddenDateCtrl.getFormattedValue()+"\" name=\""+ hiddenDateCtrl.getHtmlName()+"\">"+
"<input type=button onclick='javascript:{showCalendar(\""+ forPrompt+"\", this, "+
hiddenDateCtrl.getParent().getName()+ "."+hiddenDateCtrl.getHtmlName()+", "+
"\"yyyy/mm/dd\",null,"+ (futureonly ? "0":"1")+ ");return false;}' "+
"value='"+ dateTxtPrompt+"' "+
"name=\""+ hiddenDateCtrl.getHtmlName()+ "calendar\""+
"style='font-size:11px'>"+
"<label value=\"");
}
}
public void makeDateCalendarButton(Control hiddenDateCtrl, String forPrompt) {
makeDateCalendarButton( hiddenDateCtrl, forPrompt, false);
}

It will work for dates in grid tables and in records.

Regards

Anton
Java Certified Contractor

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.

MS Access to Web

Convert MS Access to Web.
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.