CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Search records automatically display, I wish not.

Print topic Send  topic

Author Message
drc3
Posted: 12/01/2003, 4:10 PM

Hi,
I am evaluating code charge studio. I am creating an asp based search page using the application builder. By default, when the page open in the browser all the items will list out. I have 4 search fields. I tried the method listed below but could not get it to work. Is there a way to do this in the Project Deisgn View?
Thanks.
Duane Champion
Penn State Public Broadcasting


Note however, that the above method will only work properly when there is only one search field. In the case where you have multiple search fields, the default values would interfere with the search when just some of the fields receive a search value while others don't. The fields that don't receive a value from the search form would revert to their default values and thereby cause no records to be retrieved. As such, a different method has to be used which involves placing code in the Before Execute Select event of the grid. Basically, a condition is used to check whether the where clause is empty as a result of having received no search criteria and if it is, the code sets a where clause which will not return any records.

'ASP
if (FormName.command.Where = "") then
FormName.command.Where = "FieldName = impossible_value"
end if

//PHP
global $FormName;
if ($FormName->ds->Where == "")
$FormName->ds->Where = "FieldName = impossible_value";

In the above code, FormName and FieldName should be substituted with the actual names of the grid form and database field respectively while impossible value should be replaced with a value of the same data type as the field but for which there will be no matching database value.



mentecky
Posted: 12/02/2003, 4:15 PM

This takes very little code actually.

First, click on the grid Tag looking icon. In the properties window click data source. In one of your "Where" parameters set default to an impossible value. This will stop the list from showing any values.

Now, if you want to hide the entire grid... Click "Events" in the properties. Add a Before Show event. The following code should work in PHP.

$formname->Visible = ($formname->ds->RecordsCount > 0);

I think there is an example of this in the CCS help files under Tips and Tricks.

Hope that helps,

Menty

   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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