lneisius
|
| Posted: 11/21/2002, 8:45 PM |
|
1) I would like to display the members full name instead of two colums with first name and last name in the grid form as well as use it for the link to the edit record form. should i create an sql query in the db or in the app? Any help on the best method and complete instructions on how to create would be appreciated.
2) I created a link on the default start page in the banner that links to the edit member form, and would like it to display the users first name instead of the session variable as shown below. Should i use sql, create a var, etc..?
Function Banner_UserName_BeforeShow() 'Banner_UserName_BeforeShow @2-1571794C
'Custom Code @7-73254650
' -------------------------
Banner.UserName.Value = "Register"
If Session("UserID") >= 1 Then Banner.UserName.Value = Session("UserLogin")
' -------------------------
'End Custom Code
End Function 'Close Banner_UserName_BeforeShow @2-54C34B28
|
|
|
 |
Lorenz
|
| Posted: 11/21/2002, 11:28 PM |
|
About first question, the solution is quite simple. In codecharge,"extract" first and last name creating appropriate fields, they must be hidden type.
Plus, create a label field (or URL) that is not taken from tables, (i.e. assume that its name is "Nominativo").
In before show event write (in PHP) :
$fldNominativo = $fldLastName." ".$fldFirstName ;
$fldNominativo = "<a href='..................'>".$fldNominativo."</a>" ; //(to link)
-----------------------------------------------------------------------------
Or, a second way is concatenating one field to another :
$fldLastName .= " ".$fldFirstName ;
I don't use it because i prefer to leave fields inalterate, even in visualizing.
|
|
|
 |
lneisius
|
| Posted: 11/22/2002, 4:26 AM |
|
Sorry but I,m using ASP
|
|
|
 |
Edd
|
| Posted: 11/22/2002, 4:57 AM |
|
If you are displaying the full name of the individual you should really use SQL as it will be faster. Change your table data select to SQL and ADD a concatination of the two values, i.e. CONCAT(first_name, ' ' , last_name) in MySQL and String(first_name & ' ' & last_name) in MSSQL. Leave the First and Last names as part of the SQL as you may wish to use them for sort purposes.
For the User Name use the CCDLookup method, eg
Banner.UserName.Value = "Register"
If Session("UserID") >= 1 Then
Banner.UserName.Value = CCDLookup("CONCAT(first_name, ' ' , last_name)", "MyUserTable", "UserID='" & Session("UserLogin") & "'", MyDatabase)
End If
|
|
|
 |
jAMES
|
| Posted: 11/22/2002, 9:13 AM |
|
drag the label from last name into first name (best to enter a space after first name in the first name column first).
then delete last name column
|
|
|
 |
lneisius
|
| Posted: 11/23/2002, 11:18 PM |
|
ED
Tryed this but?
Error is
Variable is undefined: 'DBMembers'
/portal/Welcome_events.asp, line 11
Welcome.LogAction.UserName.Value = "Register"
If Session("UserID") >= 1 Then Welcome.Logaction.UserName.Value = CCDLookup
("first_name", "members", "UserID='" & Session("UserLogin") & "'", DBMembers)
If I include "" around DBMembers I get an error message connection required So I believe the code is correct trough the connection. I placed this in a grid form to open the data base for me but with no luck.
|
|
|
 |
|