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

 Parameter operation in Search form

Print topic Send  topic

Author Message
telmiger

Posts: 61
Posted: 04/08/2014, 6:33 AM

My search form has a listbox (listbox1) and a text box (text1). I select s_name from the listbox1 and type test in the text box and hit search.

My url parameter will shows listbox1=s_name&text1=test.

What I would like to do when I hit the search button is read the 2 entries and combine the 2 parameters to a new parameters that reads like

s_name=test

Has anybody figured this out yet?

This would enable me to reduce the size of the search forms if the user could select the search parameters from a listbox instead of creating multiple text boxes for all database fields.

Thanks

Tony
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 04/13/2014, 6:06 PM

You can concatenate values simply using a period (full stop/dot) and this can be done in the on validate event...

$s_name = $container->s_name->GetValue();
$text1 = $container->text1->GetValue();
$s_name = $s_name.$text1;
_________________
Central Coast, NSW, Australia.

View profile  Send private message
eratech


Posts: 513
Posted: 05/05/2014, 10:04 PM

telmiger - yes you can do it.

Something similar (with several other options) is available in the 'Search Builder' under Advanced Search -> "Single Search Field with Advanced Search" (search Help for "Advanced search")

For manually setting up your own listbox and searches, however:

1. Set up your Grid or results as you would. I didn't get the Builder to create the Search form, I did that afterwards with a 'New Record' and chose Search, for layout simplicity.

2. Add the Listbox (s_listfields) and Textbox (s_text) as you did, and populate the listbox as 'List of Values' with the value being the database table column name and the text being some nice user name (eg: emp_name; Employee Name)

3. In the Datasource for the Grid, change it to type 'SQL' and add URL parameters for our search fields (s_listfields and s_text) and add them to the SQL in the WHERE clause - so that the value from the s_listfields will be the column to search on:

SELECT *   
FROM employees   
WHERE {s_listfields} like '%{s_text}%'

This does a full search with LIKE but you can adjust it. It works much better with same data types (ie: all Text fields) but you can add different code. I suspect you could even add more WHERE parts into the s_listfields such as "emp_id=" and change the WHERE to
WHERE {s_listfields} {s_text}
but I haven't tried it.

Hope that helps

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message

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.