CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 SQL Parameter Window - How to use it?

Print topic Send  topic

Author Message
teufel
Posted: 09/13/2002, 1:48 PM

I have a page composed of a (1)search form, (2)a grid, and (3)another customized grid which sums the values of the first grid grouping them by type (e.g.: grid one is a complete list of products and grid two is a list of these products with values totalized grouped by type of product).

So for the second grid, the type of data source is SQL, and the data source is an SQL command more or less like the example below (MySQL):

SELECT product_type.product_name AS name, sum(products.product_value) AS value FROM product_type, products WHERE product_type.product_code=products.product_type_fk GROUP BY name ORDER BY name

This works beutifully, but I also want this SQL query to consider in its WHERE clause the values of the URL parameters as specified in the search form (that is, the filters should also be applied to this second grid).

Lets say my filter is an initial date (it appears at the URL as s_initial_date=01%2F01%2F2002).

Inside the dialog window named 'Data Source' I have this SQL statement at the upper part, and I think I should specify this date URL parameter at the bottom part. Clicking over the '+' button, another dialog window called 'SQL Parameter' is opened with the following info in it:

On the left side:

Variable:

- Name: ???
- Type: (drop-down box -> i selected 'Date')
- Format: should I let it empty?

On the right side:

Parameter Source:

- Name: (I filled it with 's_initial_date')
- Type: (drop-down box -> I selected URL)
- Format: should I let it empty?
- Default Value: (I MUST fill this, but no matter what I put here it says I have the wrong format for it)


Any examples or hints on how to do this? Am I on the right way?


Thanks,
teufel
CodeCharge Support
Posted: 09/16/2002, 6:05 AM

Hello,
Once you’re using custom sql query you should include all the fields into Where clause. In your case sql should be like:
SELECT product_type.product_name AS name, sum(products.product_value) AS value FROM product_type, products WHERE product_type.product_code=products.product_type_fk
and initial_date = ‘{initial_date}’
GROUP BY name ORDER BY name

Then you should add parameter initial_date under Parameters section of Data Source window.
The settings for date type field should be like:
Variable
Name: initial_date
Type: Date
Format: specify the one in case it is different from date format set up in server side connection settings.
Parameter Source
Name: s_initial_date (the name of the parameter passed to the page
Type: URL (in your case)
Format: select the one of necessary if it is different to date type of the Variable
Default Value: it is required parameter. Enter the date value that will be used if no value is passed to the page. Its format should match the date format selected for the Variable Format (or if the one is empty it should match the date format selected in the server connection settings).

Gene
Posted: 01/01/2003, 12:24 PM

I have the same kind of page setup. And I used the instruction that mentioned above. And it did not work.
Help, please!

   


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.