Case #19 - Calculated fields using NameMap

I have JOIN fields in my dbSQL with the same fieldnames from different tables. When I use ASP to open the query, duplicated names are being returned and the origin of the fields are lost. How does ASPdb handle this ?
Look at the following sample code –

<%
SQLSTR= "SELECT Job.JobNumber as j1, JobStatus.Description as d1, JobType.Description as d2"
SQLSTR = SQLSTR & "FROM (Job INNER JOIN JobStatus ON Job.JobStatusCode = JobStatus.JobStatusCode) INNER JOIN JobType ON Job.JobTypeCode = JobType.JobTypeCode"
Set X = Server.CreateObject("ASP.DB")
X.dbquickprops="1;d:\vbx\testdir\test.mdb;test;grid;4"
X.dbSQL = SQLSTR
X.dbFilterFlds = "0,d1,d2"
X.dbnamemap = "j1,Job_Number,,Job.jobnumber; 1,Job_Status,,JobStatus.Description; 2,Job_Type,,JobType.Description"
X.dbNavigationItem = "top, prev, next, bottom, reload, filter"
X.ASPdb
%>

Follow the following procedures –

  1. In Line #1, create aliases for the SELECT fields to eliminate the name duplication. For example – JobStatus.Description as d1.
  2. Specify either the aliases names or field numbers in the dbFilterFlds. Do not use original names.
  3. Place the original fields names in the 4th field in each group of the dbNameMap property.
  4. Now Sort and Filter will function correctly. Remember that Edit is not allowed in JOIN type queries.