Skip to main content
March 31, 2008
Question

dynamic text name comes from id #

  • March 31, 2008
  • 2 replies
  • 293 views
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.


This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
March 31, 2008
.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
March 31, 2008
it's either do it this way, or just change all the data in the database.