CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Bind a label to a lookup table

Print topic Send  topic

Author Message
Jack Brewster
Posted: 08/27/2002, 2:02 PM

Maybe I'm just dense, but I can't figure out how to get a label to lookup
it's value from another table. I did this in CodeCharge without a problem.
I can't seem to find a property or anything that allows me to do this in
CCS. I have 1.0.7

I have a list of schools in one table with a list of school types in
another. The schools table has the school name and a number that
corresponds to the id in the lookup table. For example:

schools table:
id - school_name - school_type_id
1 - Chinook - 1
2 - Horizons - 1
3 - Lakes - 2
4 - River Ridge - 3

The school_type table has an id and then its value:

school_type table:
id - type
1 - Elementary School
2 - Middle School
3 - High School

On the grid that lists all of the schools, I'd like it to look like this:
Chinook Elementary School
Horizons Elementary School
Lakes Middle School
River Ridge High School

What am I not getting?

Thanks,

Jack

cornwell
Posted: 08/27/2002, 3:11 PM

You must create the sql to get the fields you wish to display
The old way was better IMHO


"Jack Brewster" <jbrewsterPLEASENO@SPAMnthurston.k12.wa.us> wrote in message
news:akgpdo$th4$1@news.codecharge.com...
> Maybe I'm just dense, but I can't figure out how to get a label to lookup
> it's value from another table. I did this in CodeCharge without a
problem.
> I can't seem to find a property or anything that allows me to do this in
> CCS. I have 1.0.7
>
> I have a list of schools in one table with a list of school types in
> another. The schools table has the school name and a number that
> corresponds to the id in the lookup table. For example:
>
> schools table:
> id - school_name - school_type_id
> 1 - Chinook - 1
> 2 - Horizons - 1
> 3 - Lakes - 2
> 4 - River Ridge - 3
>
> The school_type table has an id and then its value:
>
> school_type table:
> id - type
> 1 - Elementary School
> 2 - Middle School
> 3 - High School
>
> On the grid that lists all of the schools, I'd like it to look like this:
> Chinook Elementary School
> Horizons Elementary School
> Lakes Middle School
> River Ridge High School
>
> What am I not getting?
>
> Thanks,
>
> Jack
>
>

Jack Brewster
Posted: 08/27/2002, 3:20 PM

I'd agree, at least for quick and dirty ones.

So the next question, where the heck do I get in to add the SQL? I'm
running the CCS plug-in from FrontPage2002.

Thanks!

Jack

"cornwell" <keijen@ozemail.com.au> wrote in message
news:akgteo$53g$1@news.codecharge.com...
> You must create the sql to get the fields you wish to display
> The old way was better IMHO
>
>
> "Jack Brewster" <jbrewsterPLEASENO@SPAMnthurston.k12.wa.us> wrote in
message
>news:akgpdo$th4$1@news.codecharge.com...
> > Maybe I'm just dense, but I can't figure out how to get a label to
lookup
> > it's value from another table. I did this in CodeCharge without a
> problem.
> > I can't seem to find a property or anything that allows me to do this in
> > CCS. I have 1.0.7
> >
> > I have a list of schools in one table with a list of school types in
> > another. The schools table has the school name and a number that
> > corresponds to the id in the lookup table. For example:
> >
> > schools table:
> > id - school_name - school_type_id
> > 1 - Chinook - 1
> > 2 - Horizons - 1
> > 3 - Lakes - 2
> > 4 - River Ridge - 3
> >
> > The school_type table has an id and then its value:
> >
> > school_type table:
> > id - type
> > 1 - Elementary School
> > 2 - Middle School
> > 3 - High School
> >
> > On the grid that lists all of the schools, I'd like it to look like
this:
> > Chinook Elementary School
> > Horizons Elementary School
> > Lakes Middle School
> > River Ridge High School
> >
> > What am I not getting?
> >
> > Thanks,
> >
> > Jack
> >
> >
>
>
DonB
Posted: 08/27/2002, 3:59 PM

Use a view as the datasource for the form (ignore the fact it says "table" -
a view is treated the same as a table). Depending on your database, this
may be referred to as a "query" rather than "view"). You can also bind the
form directly to the SQL statement, although I recommend the view technique.

Join the School_Type table with the School table (sort of like this);

SELECT s.*, st.Type FROM School s, School_Type st WHERE s.Typeid =
st.TypeID

(note I've taken guesses at your particular database's syntax, and what your
tables and columns are called, so change the above as necessary)

While it may seem that the more-complex query (vs using simply a table) is
more work, it really is best since you require one "hit" to the database
instead of two (if the label were to turn around and lookup the value to
display). If you put the SQL into a view, then you don't worry about the
underlying SQL anyway.

One thing to be aware of is that views sometimes are non-updatable, because
you can only update one table per SQL statement. In this example, you will
probably be able to update the School table, but won't be able to update the
School_Type table (which should not be a concern for you). The rules/limits
on this vary with each database engine, When this IS a problem, then you go
to the "custom update/insert/delete" properties and set them up to hit the
correct table. Again, this can make a little bit more work for you, but the
flexibility is really nice to have.

don

"Jack Brewster" <jbrewsterPLEASENO@SPAMnthurston.k12.wa.us> wrote in message
news:akgtvn$649$1@news.codecharge.com...
> I'd agree, at least for quick and dirty ones.
>
> So the next question, where the heck do I get in to add the SQL? I'm
> running the CCS plug-in from FrontPage2002.
>
> Thanks!
>
> Jack
>
> "cornwell" <keijen@ozemail.com.au> wrote in message
>news:akgteo$53g$1@news.codecharge.com...
> > You must create the sql to get the fields you wish to display
> > The old way was better IMHO
> >
> >
> > "Jack Brewster" <jbrewsterPLEASENO@SPAMnthurston.k12.wa.us> wrote in
> message
> >news:akgpdo$th4$1@news.codecharge.com...
> > > Maybe I'm just dense, but I can't figure out how to get a label to
> lookup
> > > it's value from another table. I did this in CodeCharge without a
> > problem.
> > > I can't seem to find a property or anything that allows me to do this
in
> > > CCS. I have 1.0.7
> > >
> > > I have a list of schools in one table with a list of school types in
> > > another. The schools table has the school name and a number that
> > > corresponds to the id in the lookup table. For example:
> > >
> > > schools table:
> > > id - school_name - school_type_id
> > > 1 - Chinook - 1
> > > 2 - Horizons - 1
> > > 3 - Lakes - 2
> > > 4 - River Ridge - 3
> > >
> > > The school_type table has an id and then its value:
> > >
> > > school_type table:
> > > id - type
> > > 1 - Elementary School
> > > 2 - Middle School
> > > 3 - High School
> > >
> > > On the grid that lists all of the schools, I'd like it to look like
> this:
> > > Chinook Elementary School
> > > Horizons Elementary School
> > > Lakes Middle School
> > > River Ridge High School
> > >
> > > What am I not getting?
> > >
> > > Thanks,
> > >
> > > Jack
> > >
> > >
> >
> >
>


   


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.