CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 How to feed parameters in SQL in grid

Print topic Send  topic

Author Message
Kees de Boer
Posted: 01/10/2006, 12:21 PM

Hi,

I have a search record and a grid on a page.
The grids datasource is a custom SQL Query:

SELECT p.title AS PageTitle, COUNT(*) AS NumberOfVisits
FROM midas_i_pages p, midas_i_visits v
WHERE ( EXTRACT(MONTH FROM `date` ) = '{s_Maand}' )
AND ( EXTRACT(YEAR FROM `date` ) = '{s_Jaar}' )
AND ( p.id = v.page )
GROUP BY p.id

s_Maand and s_Jaar are the search field.
As I use expressions for the 'EXTRACT' functions, I cannot specify where the values should come from.
So I end up with no records.

Anyone who can tell my if and how I can solve this?

Regards,

Kees de Boer
Walter Kempees
Posted: 01/10/2006, 3:10 PM

Kees,

Please specify CCS version and application language/Database you are using.
For now I asume CCS2.x based upon your use of the word "Expression",
PhP/MySQL

Open VisualQueryBuilder by pressing [...] on your Grid's Data Source.
This is where you have built your SQL, the window should show Data Source
Type : SQL
Then there are two main area's one is the SQL statement the other is
Parameters.
In the Parameters (if not yet shown) you press the plus sign and define your
s_Maand and s_Jaar.
In your case
Variable: s_Maand
Type: Text/Integer (whatever fits your needs)
Parameter source : s_Maand
Type: URL
and anything you might want to add.

Hope this helps


<Kees deBoer@forum.codecharge (Kees de Boer)> schreef in bericht
news:243c41766a0694@news.codecharge.com...
> Hi,
>
> I have a search record and a grid on a page.
> The grids datasource is a custom SQL Query:
>
> SELECT p.title AS PageTitle, COUNT(*) AS NumberOfVisits
> FROM midas_i_pages p, midas_i_visits v
> WHERE ( EXTRACT(MONTH FROM `date` ) = '{s_Maand}' )
> AND ( EXTRACT(YEAR FROM `date` ) = '{s_Jaar}' )
> AND ( p.id = v.page )
> GROUP BY p.id
>
> s_Maand and s_Jaar are the search field.
> As I use expressions for the 'EXTRACT' functions, I cannot specify where
> the
> values should come from.
> So I end up with no records.
>
> Anyone who can tell my if and how I can solve this?
>
> Regards,
>
> Kees de Boer
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Kees de Boer
Posted: 01/11/2006, 3:07 AM

Walter,

I forgot to mention my environment indeed : CCS 3.0 / PHP / MySQL
I had not discovered the parameter section in the visual query builder.
Managed to fix it with your help...

Thanks!

Kees de Boer
Walter Kempees
Posted: 01/11/2006, 4:09 AM

graag gedaan vanuit Capelle a/d IJssel

Your welcome.

<Kees deBoer@forum.codecharge (Kees de Boer)> schreef in bericht
news:243c4e6edb8cfa@news.codecharge.com...
> Walter,
>
> I forgot to mention my environment indeed : CCS 3.0 / PHP / MySQL
> I had not discovered the parameter section in the visual query builder.
> Managed to fix it with your help...
>
> Thanks!
>
> Kees de Boer
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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