CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Sum up Names in Dropdown for Search

Print topic Send  topic

Author Message
czevak
Posted: 07/19/2005, 2:29 AM

Hello,

when using a dropdown menu in the search-form, is it possible to sum up the names (of persons in a SQL database) that appear multiple times to one entry in the listbox?

(If the name "chester" is mentioned three times as username in the database it is also three times in the dropdown menu, but of course will not produce a different search-result. It is therfore simply useless to have these duplicates in the listbox.)

How do I get rid of these?
(I know that I could enter the listbox entries manually but I need a dynamically changing listbox when a new name ist entered in the database.)

Regards czevak.
Nicole

Posts: 586
Posted: 07/19/2005, 5:20 AM

Hello,
You can use Custom SQL as listbox’s Data Source and add DISTINCT keyword into it, in order to return unique values only

_________________
Regards,
Nicole
View profile  Send private message
czevak
Posted: 07/19/2005, 5:36 AM

Ok...let's see if I get this right:

My List Box's properties are as follows:

Name: s_namen
Caption:
Control Datasourcetype: Database Column
Control Datasource:
Database Connection: Connection1
Datasource Type: Table/View
Datasource: filterdaten <---this is my MySQL Database
Bound Column: namen
Text Column: namen

Now where would I have to put that DISTINCT keyword?
Or will I have to change the MySQL Database itself using PHPMyadmin?

Sorry but I can't figure it out, just by reading your Post.

Thank you a lot in advance, Czevak.
wkempees
Posted: 07/19/2005, 10:01 AM

take a closer look to the right of Datasource:Filterdaten there should
be a [...] icon, press that and you get visual query builder (VQB).
Take it from there.

Datasource can also be several database tables joined and filtered and
ordered and grouped, you do that all in de VQB.
Grüsse,
Walter
czevak
Posted: 07/20/2005, 5:02 AM

Danke Walter,

ich Idiot hatte doch glatt die "Sortieren nach:" Zeile im Query Builder übersehen.

Liebe Grüße aus der Pfalz,

Mario.
wkempees
Posted: 07/20/2005, 1:50 PM

Gern gemacht.
Und wer saggt das Holland Deutschland immer fussball sein muss.
czevak
Posted: 07/21/2005, 12:38 AM

Also entweder bin ich zu blöd oder es klappt aus anderen Gründen nicht. Wenn ich ihn nach Namen sortieren lassen will, sortiert er mir zwar schön nach Alphabet aber er fasst gleiche Namen nicht als eine Auswahl in der Listbox zusammen....

Hab ich wieder was übersehen oder fehlt ein passender befehl?

Gruß Mario.

For the people that don't understand German:

The Sorting function in the visual query builder sorts my names in the listbox perfectly into an alphabetic order, but doesn't sum up same names into one Listbox-selection.

Has anyone an Idea how to do this?

Regards Czevak.
peterr


Posts: 5971
Posted: 07/21/2005, 12:56 AM

See the 1st response above from Nicole - enter Custom SQL instead of using VQB. Then you can enter the exact SQL that you want, with DISTINCT or GROUP BY.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
czevak
Posted: 07/23/2005, 11:19 AM

Thank you Peterr and Nicole.

It works now.
Had to figure out the correct syntax, but Google helped me a lot.

Greetings Mario.
Damian Hupfeld
Posted: 07/23/2005, 11:50 PM

Hi Mario,

Keep the knowlege circulating and post your solution!

regards
Damian


"czevak" <czevak@forum.codecharge> wrote in message
news:542e28a2b39390@news.codecharge.com...
> Thank you Peterr and Nicole.
>
> It works now.
> Had to figure out the correct syntax, but Google helped me a lot.
>
> Greetings Mario.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

czevak
Posted: 07/24/2005, 1:32 AM

Allright then:

It is in fact really simple, if you know what to do:

In the Listbox's properties under Data there is your Datasource Type right beyond the field, where your Database Connection is listed. Select "SQL" from the Dropdown for Datasource Type.
In the Field Datasource simply put:
SELECT DISTINCT yourcolumn FROM yourtable
for Bound Column and Text Column select yourcolumn and your done.

In my case this sets the selection choices in a Dropdown-Searchfield for locations, which can now dynamically alter if a new location is inserted into the Database by a user. So there is no need to hardcode the possible selecions by hand if a new city is mentioned in the database, because the Dropdown gets them on its own.

You see its simple, but you have to know what to do.

Greetings Mario.

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.

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.