CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Date Conversion for DB2 from YYYYMMDD stored as integer

Print topic Send  topic

Author Message
jkelleyus

Posts: 3
Posted: 08/06/2011, 3:28 PM

Hi all,

I'm brand new to CCS having done some web development with PHP but had a need to do things faster and thought I'd give CodeCharge a try.

I primarily develop code for IBM iSeries Zend servers. In case anyone wants to know, preliminary results are excellent (after fiddling with the connection settings some. The CCS code runs lightning-fast and development (s0 far) is a breeze.

Here's the question: I have a database within DB2 that stores dates as YYYYMMDD in integer form. This is a very large table with an index on the date_integer field and if I input a static where of.. say date_integer=20110806 the results are quick.

If I try and modify the query in the WHERE clause to DateConverted(date_integer) the query slows down to an unacceptable level.

What I would ideally like to do is use Php to pass the parameter from a human-understandable to and convert it to YYYYMMDD prior to query execution.

Can anyone point me in the right direction as to how this accomplished in CCS?

Thanks for the help!!!

John
View profile  Send private message
datadoit
Posted: 08/06/2011, 3:49 PM

When you create your search form, you'll be using the human-readable
format, such as mm/dd/yyyy, correct?

So in your results grid, you'll update the DataSource to include a WHERE
parameter for the date field search above. You can do this in the
Visual Query Builder (the datasource), and the dialog will give you the
options of the format for the search form value (the URL parameter), and
the format of what the database is holding. CodeCharge will handle the
format conversions for you.
jkelleyus

Posts: 3
Posted: 08/07/2011, 9:02 AM

Thank you for the reply. If I simply wanted to construct a single page that would pull data from this table based on today's date, how would I do so?

What I would need is a way to convert the default parameter from a static to the system date in the form of (for August 7, 2011 or 2011-08-07) to 20110808 as an integer.

I know I have a long road ahead in learning all the ins-and-outs of CCS, so any help is greatly appreciated.

Thanks again!

John
View profile  Send private message
datadoit
Posted: 08/07/2011, 10:07 AM

In the grid's datasource, add a WHERE parameter. On the left side of
the dialog choose the date field you're comparing against. On the right
side, put in something like date('Ymd'), and set the type to Expression.
jkelleyus

Posts: 3
Posted: 08/07/2011, 10:44 AM

The parameter dialog seems confusing to me (forgive me, I'm an SQL coder first and foremost).

Do I simply add a WHERE with nothing behind it and the parameter dialog takes care of the rest, or do I need to add variables into the actual datasource SQL?

Thanks again,

John
View profile  Send private message
datadoit
Posted: 08/07/2011, 11:43 AM

Sent a PM. I'll walk you through it tomorrow.

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.