Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

dynamic text name comes from id #

Guest
Mar 31, 2008 Mar 31, 2008
Unfortunately I was given a database that has identified almost everything with a number rather then a name. This requires multiple calls to the database as a result. What the best way to display results in a repeating region, where that number is turned into the name. for example, let's say you have a recordset where it pulls results where category is equal to numbers that range from 1-10. you have a second table the has all the category names and their numbers. When you display the repeating region of all the results, you get the name, as found in the second table, rather then the number.


TOPICS
Server side applications
292
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 31, 2008 Mar 31, 2008
it's either do it this way, or just change all the data in the database.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 31, 2008 Mar 31, 2008
LATEST
.oO(jsteinmann)

>Unfortunately I was given a database that has identified almost everything with
>a number rather then a name.

That's quite common, because numbers are much more efficient to identify
records (primary keys) and to create relations between different tables
(foreign keys).

>This requires multiple calls to the database as a
>result.

No. Usually you can do it with pure SQL and a single query.

>What the best way to display results in a repeating region, where that
>number is turned into the name. for example, let's say you have a recordset
>where it pulls results where category is equal to numbers that range from 1-10.
> you have a second table the has all the category names and their numbers.
>When you display the repeating region of all the results, you get the name, as
>found in the second table, rather then the number.

This is done in SQL with a JOIN, but without knowing more details about
your table structure it's difficult to give a real example. It will be
something like this:

SELECT this, that, ..., categoryName
FROM yourTable t
INNER JOIN categories c ON t.categoryId = c.categoryId
WHERE t.categoryId BETWEEN 1 AND 10

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines