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

 Replace key with text in grid->label

Print topic Send  topic

Author Message
mfratto

Posts: 34
Posted: 07/08/2005, 1:04 PM

I can't suss this out.

I have a grid called "market" and in that grid are two columns. One is called "market" and is a text field. The other (that I am having trouble with) is called "fk_mstatus". My db has a table called market with a field called name and a field called fk_mstatus which is a foreigh key in a table called status which has an id and the field called mstatus, which contains the text.

When I display the list of markets, I want the market name and the status name. Right now I get the status.id number. I am using the BeforeShow event on the grid Market, lable fk_status field and the code is below. $Products is the name of the DB in the MySQL DB.

$market->fk_mstatus->SetValue(CCDLookUp("mstatus","status","id=".
$Products->ToSQL($fk_mstatus, ccsInteger), $Products));

When I try the code, I get "Fatal error: Call to a member function on a non-object in c:\inetpub\wwwroot\products\market_events.php on line 39" so it looks like a naming issue. I have been, and will keep pouring over the help files, but I am kinda lost.

Any pointers, thanks.

View profile  Send private message
mfratto

Posts: 34
Posted: 07/08/2005, 1:16 PM

Hah, I knew if I sent out an email I would figure it out. Now the question is where can I find out how CCS names things. I haven't found a single reference to the fact that a database connection name "Products" automagically "DB" prepended so that it is now named "DBProducts"?

What is the convention? What other ones are there?
View profile  Send private message
wkempees
Posted: 07/09/2005, 8:21 AM

SO you figured it out while sending the mail, good for you.
BUT:
The easiest way to get the result you want would be (no laughing please):

Open your project.
Open the page containing the GRID in Design mode.
On the ProjectExplorer open the tree view of your Grid and click the
properties of the grid containing the result, not the search (If you
have one).
On the properties look for Data Source, click it and the [...] button
appears, from there on change your datasource to contain the table
containg the textfield for fk_message as well as your main table and the
appropriate linking setting. It will do the actual lookup for you
without any further effort!

Click on the fk_status field in the DataRow (meaning not the header)
Delete the column, using the DeleteColumn from top menu.
Click insert column
In the resulting cell from the FormsToolbox choose Label.
You can set all your textuals right as you wish but you have to:
In the Properties of this Label Select the message text field.

This should do it.
My approach however would be
(Bearing in mind that I'm the laziest person on earth but one, that
being the reason for purchasing Clarion, CodeCharge, CodeChargeStudio)
to delete the grid, start afresh with the appropriate Builder and have
CCS do it for me.
It takes a few moments but using the builder you could have done this
from the start.
Hint: in the BuilderWizard step where it asks you to define the grid,
simply select the fields for the grid, the push the property icon on the
right hand side after changing your field type from Integer to Lookup.

Lots of fun !

Walter
wkempees
Posted: 07/09/2005, 8:25 AM

All (nearly all) are in the Help file.
Or on the Codecharge/YesSoftware website as dowloadables.
Search Components
mfratto

Posts: 34
Posted: 07/09/2005, 8:40 AM

Thanks Walter. I will follow your suggestion. As you can tell, I am just starting with CCS, so I am still getting to know the enviornment.

As for the naming conventions, I haven't found it yet in the help file, but I need to get familiar with it as well.

I appreciate the answer, Mike.
View profile  Send private message
wkempees
Posted: 07/09/2005, 8:46 AM

Do the examples from the helpfiles step-by-step specialy TaskManager.
It will take your time, concentration but will result in hands-on
experience as well as guide you through the Help.
Also scanning though your projects Common files will give insight.

Happy exploring.
mfratto

Posts: 34
Posted: 07/09/2005, 9:02 AM

Yeah, I did the examples, that is how I figured out to prepend the letters "DB" to the connection name. :-)

This forum is a really good resource for CCS. I have already found answers to other problems and some neat features others have asked about I hadn't thought of.

Off to code.
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.

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.