CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Search result to non-table lable?

Print topic Send  topic

Author Message
elipsett
Posted: 01/25/2003, 5:45 PM

Is it possible to have a label which can display data returned from an SQL search on a table field? For example, suppose I have an entry for a store name, and I want to just display a list of people working at that store.

Is it possible to use the store name as a key, and return the names of all contacts at that store (from a separate table)into a simple label? I don't want to edit them, just display them.

If this is possible, it would mean I can display a lot of information without having to individually create table fields each time I need to show something else.

Thanks.

Edward Lipsett
Fukuoka, Japan
RonB
Posted: 01/26/2003, 3:48 PM

Yes offcourse. In the prperties box set the label to code expression and do a beforeshow event.

$mygrid->my_label->setvalue(CCGetDBValue("select people from store where store_id=".$mylabel->store_id->Value,$DBYourconnection_name));

Ron

elipsett
Posted: 01/26/2003, 8:33 PM

Thank you, Rob.

I had no doubt it was possible, and can generally see what you're doing in that code, but unfortunately it is not at all clear exactly how to implement it.
Apparently no coding input assistants are provided for this level of coding.

Is this SQL language we're talking here?
In other words, to underatand your answer and be able to use this technique, I should be studying SQL?
elipsett
Posted: 01/26/2003, 9:14 PM

Hi, Ron (not Rob, sorry <g>)

OK, some research yielded the following code, which doesn't seem to work.
I created a new page, added a list box to display a list of authors named author_name from a different table (only one DB involved here). The list of authors works.
I then added a label named testing, and entered the following for custom code:
// -------------------------
$testing=CCDLookUp("title","source_tit_list","author"='author_name',$hanshu_booklist);

The table I want it to look in is named aource_tit_list (that's short for title, BTW). Within that table are several fields, one of which is named author and one of which is named title. I want to compare the entry for author_name on this page with all author entries in source_tit_list, and display all title entries for matching authors on this page in the testing label.

I have tried numerous times, and the label remains blank no matter what.
Any idea of where I might be wrong? (field names are upper/lower case are correct)

Thanks.
elipsett
Posted: 01/26/2003, 9:48 PM

I noticed a few syntax problems, so it now reads:
// -------------------------
$Testing=CCDLookUp("title","source_title","author=' author_name' ", $hanshu_booklist);
// -------------------------
source_title is the actual name of the table in the MySQL DB. title and author are two fields in it. author_name is the nameof the list box on this page, and Testing the name of the label I want to display the results in.

When I run this, I get the following error:
olumn_Required)"/> ; = new clsSorter( "" return ""; } //End Operations Method ?> ; = new cls (); ->BindEvents(); ->TemplatePath = " "; ->TemplatePath = "./"; LoadTemplate($this->TemplatePath . $this->TemplateFileName, $Name); $this->candidates_list->Show(); $this->people_list->Show(); $this->source_tit_list->Show(); $this->Dropdowns->Show(); $Tpl->Parse($Name, false); $Tpl->SetVar($Name, $Tpl->GetVar($Name)); } //End Show Method ?>End Header Class @1-FCB6E20C
Fatal error: Call to a member function on a non-object in C:\sokkit\site\hanshu_booklist\Common.php on line 311

Any ideas?
elipsett
Posted: 01/28/2003, 4:20 PM


I am having problems getting this working, and sinc the documentation and provided sample projects are next to useless, I would greatly appreciate a short, simple project that uses this function to do something. If I can see a working example I can no doubt figure out how to get it working on my own system.

If anyone has one, I would greatly appreciate it if you could tell me where to find it, or just ZIP it up and send it to me.

Thanks.

Edward Lipsett
elipsett@intercomltd.com
Fukuoka, Japan
RonB
Posted: 01/29/2003, 6:56 AM

"I want to compare the entry for author_name on this page with all author entries in source_tit_list, and display all title entries for matching authors on this page in the testing label."

The problem is in what you want and how both tyhe CCDLookUP and CCGetDBValue functions work. They are both designed to return one value, not a list of values.

What you want is only possible in a grid. One way would be to create a search form with a dropdownlist of authors, choose one click search and get all titles from that author in the target grid, either on the same page or a different one. Or by creating a grid that shows authors and maybe some info about them, making the authorname a link and clicking the link opens all titles for that author in, again, a different target grid.

Ron
elipsett
Posted: 01/29/2003, 4:16 PM

The help file does say, however, that it "returns the value of the first returned field." The code I am trying to get working returns either nothing at all or an error message, and I can't determine where the problem is.

Is there any sample project code using this function that I can actually open up and look at to see specifically how it is written?

What function should I be using to return a list of results?

   


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.