dbNameMap | dbFormNameMap

Rename the field names in the header display and optionally supply the calculated expression required for the edit and filter criteria.

Property Syntax

Obj.dbNameMap="(;,)FieldNameNumber,Alias,CellTag,CalcFieldExp; ...repeat"
Obj.dbFormNameMap="(;,)FieldNameNumber,Alias,CellTag,CalcFieldExp; ...repeat"

Parameters

Parameters

Description

FieldNameNumber Field to be mapped.
Alias The mapped name.
CellTag The html code to be inserted into the <TH > tag for the column title header cell. SPAN tag is often used to span the Mapped Name across multiple cells.
CalcFieldExp This optional parameter defines the calculated expression of the field. This parameter is required for the filtering and editing criteria. See following case study examples. Note that the formula field must provide the appropriate wrappers for the alias fields [MS] (ORACLE) etc..

Example - Access

<%
Set X = Server.CreateObject("AspDB.pro")
X.dbDSN = "NWIND"
X.dbUnit = 1
X.dbMode = "Grid"
X.dbSQL = "Select FirstName,LastName as [MY LAST], FirstName + ' ' + LastName as 'Full Name' from Employees"
X.dbNameMap = "1,MY LAST,,LastName; 2,Full Name,,FirstName + ' ' + LastName"
X.dbFilterFlds = "0,1"
X.dbNavigationItem = "top,bottom,prev,next,filter,resetfilter"
X.ASPdbpro
%>

 

Example - MS-SQL

<%
Set X = Server.CreateObject("AspDB.pro")
X.dbDSN = "NWIND70"
X.dbDBType="SQL"
X.dbUnit = 1
X.dbMode = "Grid"
X.dbSQL = "Select FirstName,LastName as [MY LAST], FirstName + ' ' + LastName as 'Full Name' from Employees"
X.dbNameMap = "1,MY LAST,,LastName; 2,Full Name,,FirstName & ' ' & LastName"
X.dbFilterFlds = "0,1"
X.dbNavigationItem = "top,bottom,prev,next,filter,resetfilter"
X.ASPdbpro
%>
The browser output of the above SQL code is identical to the ACCESS output. This illustrates that ASPdb code is very reusable. Note that FirstName & LastName will work in ACCESS but FirstName + LastName will work in both ACCESS and SQL.
 

 

Example - Oracle

ORACLE Example -

<%
Set X = Server.CreateObject("AspDB.y2k")
X.dbDSN = "DSN=ora805; UID=scott; PWD=tiger"
X.dbDBType="ORACLE"
X.dbUnit = 1
X.dbMode = "Grid"
X.dbSQL="SELECT empno, ename || ' the ' || JOB ""Employee info"" FROM emp"
X.dbNameMap = "1,Employee info,,(ENAME || ' the ' || JOB)"
X.dbFilterFlds = "0,1"
X.dbNavigationItem = "top,bottom,prev,next,filter,resetfilter"
X.ASPdby2k
%>

As you can see that this ACCESS/SQL equivalent of SELECT...AS can be easily done with ASPdb. 

 

Notes
 

X.dbSQL = "Select FirstName,[Last Name] as [MY LAST], FirstName & ' ' & [Last Name] as  [Full Name] from Employees"
X.dbNameMap = "1,MY LAST,,[Last Name]; 2,Full Name,,FirstName & ' ' & [Last Name]"

 

See Case Study #23 - Complex queries using NameMap

See Case Study #19 - CalcFieldExp