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

 Retrieve Grid Label value in before show event

Print topic Send  topic

Author Message
Headhunter
Posted: 06/08/2003, 8:27 AM

PHP4.0, Mysql, CCS2.1

Is it possible to retrieve the Grid Label value in a before show event?

I need the value to do a database lookup and there after set a new value (text) with CCSetValue()

My code so far:

global $DBcarportal;
global $cars_list;
$lang=CCGetParam("lang","");
$lbl_value=CCGetDBValue("select tll_label from tags_lbl where tll_lang_id = $lang and tll_tag_id = $car_color_id", $DBcarportal);
$cars_list->car_color_id->SetValue($lbl_value);

I need to retrieve the value from "car_color_id" from the grid in befor show event of the label. Don't know if it is possible or not.
Karen
Posted: 06/08/2003, 9:10 PM

If this is just a grid and not an editable grid, you don't need to use custom code. You can use the query builder to link the lookup table and select that as the control source from the drop-down list.

Hope that helps!
Headhunter
Posted: 06/09/2003, 12:29 AM

I know, but...

I have lets say the master table with my data and 2 lookup tables.
in the master table I have a relation to the first lookup table "tags". In the "tags" table I have a relation to another table called "tags_lbl". In my "tags_lbl" are for each occurence in the "tags" table 3 labels in 3 languages. So if I have in my "products" table a record with color = 2, then I lookup this record in the "tags" table, where 2 = Red. In the table "tags_lbl" I have 3 records with tll_tag_id = 2. One label in dutch, one in english and one in french. Probably it's simple, but my SQL language cnowledge is very small. I tried a join from table to table in the visual query builder and specified a where clause from my language, but the query doesn't show all my data anymore.

RonB
Posted: 06/09/2003, 2:31 AM

if you want the lookup to occur before each row is shown, put the code in the before showrow event.

The query builder option is a better one. Just remenber to set a default value for the lang parameter. In the query builder first select all relevant tables,probably:
- language
- tags_lbl
- cars
- car_colors?
then join them properly and add the parameter lang_id as an url parameter.


The problem with your code is that you use the variable $car_color_id wich is not defined in your code yet. You do that later on with:

$cars_list->car_color_id->SetValue($lbl_value);

So if you want to use it you'll have to define it first:

global $DBcarportal;
global $cars_list;
$lang=CCGetParam("lang","");
//get the old car_color_id value to use it in your lookup code
$my_car_color_id=$cars_list->car_color_id->GetValue();
//now use it in the CCGetDBValue()
$lbl_value=CCGetDBValue("select tll_label from tags_lbl where tll_lang_id = $lang and tll_tag_id = $my_car_color_id", $DBcarportal);
$cars_list->car_color_id->SetValue($lbl_value);

Ron





   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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