This topic is locked

Default Value from another Table

6/24/2009 1:54:05 PM
ASPRunnerPro General questions
B
bhicks11 author

Hi All,
I would like to get a field in an ADD page to have a value from another table for default. Can anyone tell me the best way to do this?
Bonnie

J
Jane 6/25/2009

Bonnie,
select this value from another table in theAdd page: Before process event on the Events tab and save it in the session variable.

Then use this session variable as default value on the "Edit as" settings dialog on the Visual Editortab.

C
clig 6/25/2009

Hi All,

I would like to get a field in an ADD page to have a value from another table for default. Can anyone tell me the best way to do this?
Bonnie


Something like:
strSQLExists = "SELECT TicketNo, SYSType, CustomerNo, ProjectNo, Customer, DateEntered, EnteredBy, NTSSSkillset, SIMSRegion, SIMSTicketNo, ITIL, Status, Priority, Description, SLADateTime, ExtraDetail, AssignedTo, DateAssigned, DateResolved, ResolvedBy, Resolution, ResolutionLocale, Conclusion FROM NTSS_Tickets_Strip Where TicketNo = " & Request.QueryString("editid1")

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection

if not rsExists.eof then

Session("TicketNo") = rsExists("TicketNo")

Session("SYSType") = rsExists("SYSType")

Session("CustomerNumber") = rsExists("CustomerNo")

Session("ProjectNo") = rsExists("ProjectNo")

Session("Customer") = rsExists("Customer")

Session("DateEntered") = rsExists("DateEntered")

Session("EnteredBy") = rsExists("EnteredBy")

Session("NTSSSkillset") = rsExists("NTSSSkillset")

Session("SIMSRegion") = rsExists("SIMSRegion")

Session("SimsTicketNo") = rsExists("SIMSTicketNo")

Session("ITIL") = rsExists("ITIL")

Session("Status") = rsExists("Status")

Session("StatusOrg") = Session("Status")

Session("Priority") = rsExists("Priority")

Session("Description") = rsExists("Description")

Session("SLADateTime") = rsExists("SLADateTime")

Session("SLADateTimeOrg") = Session("SLADateTime")

Session("ExtraDetail") = rsExists("ExtraDetail")

Session("AssignedTo") = rsExists("AssignedTo")

Session("AssignedToOrg") = Session("AssignedTo")

Session("DateAssigned") = rsExists("DateAssigned")

Session("DateAssignedOrg") = Session("DateAssigned")

Session("DateResolved") = rsExists("DateResolved")

Session("ResolvedBy") = rsExists("ResolvedBy")

Session("Resolution") = rsExists("Resolution")

Session("ResolutionLocale") = rsExists("ResolutionLocale")

Session("Conclusion") = rsExists("Conclusion")

Session("NTSSSkillset1") = rsExists("NTSSSkillset")

Session("NTSSTicketNo") = Request.QueryString("editid1")

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Customer: " & Session("Customer") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>SIMS Call ID: " & Session("SimsTicketNo") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Original Followup: " & Session("SLADateTime") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Date Pending (Resolved): " & Session("DateResolved") & "</b></font>
"

Response.Write "<hr size=2 align=center color=#85D633 width=""100%"">"

else
end if

rsExists.Close : set rsExists = Nothing

  • then use a session var as a default... You didn't specify how you would get a value from another table - is it based on primary key for example this query looks in another table based on the primary key of the current page / backend query

B
bhicks11 author 6/26/2009

Nice Cliq. My relations would be "Where SubID = " & Request.QueryString("subid")" I believe.
So this would go in the Add Page: Before Process as Jane mentioned?
Thanks,
Bonnie



Something like:
strSQLExists = "SELECT TicketNo, SYSType, CustomerNo, ProjectNo, Customer, DateEntered, EnteredBy, NTSSSkillset, SIMSRegion, SIMSTicketNo, ITIL, Status, Priority, Description, SLADateTime, ExtraDetail, AssignedTo, DateAssigned, DateResolved, ResolvedBy, Resolution, ResolutionLocale, Conclusion FROM NTSS_Tickets_Strip Where TicketNo = " & Request.QueryString("editid1")

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection

if not rsExists.eof then

Session("TicketNo") = rsExists("TicketNo")

Session("SYSType") = rsExists("SYSType")

Session("CustomerNumber") = rsExists("CustomerNo")

Session("ProjectNo") = rsExists("ProjectNo")

Session("Customer") = rsExists("Customer")

Session("DateEntered") = rsExists("DateEntered")

Session("EnteredBy") = rsExists("EnteredBy")

Session("NTSSSkillset") = rsExists("NTSSSkillset")

Session("SIMSRegion") = rsExists("SIMSRegion")

Session("SimsTicketNo") = rsExists("SIMSTicketNo")

Session("ITIL") = rsExists("ITIL")

Session("Status") = rsExists("Status")

Session("StatusOrg") = Session("Status")

Session("Priority") = rsExists("Priority")

Session("Description") = rsExists("Description")

Session("SLADateTime") = rsExists("SLADateTime")

Session("SLADateTimeOrg") = Session("SLADateTime")

Session("ExtraDetail") = rsExists("ExtraDetail")

Session("AssignedTo") = rsExists("AssignedTo")

Session("AssignedToOrg") = Session("AssignedTo")

Session("DateAssigned") = rsExists("DateAssigned")

Session("DateAssignedOrg") = Session("DateAssigned")

Session("DateResolved") = rsExists("DateResolved")

Session("ResolvedBy") = rsExists("ResolvedBy")

Session("Resolution") = rsExists("Resolution")

Session("ResolutionLocale") = rsExists("ResolutionLocale")

Session("Conclusion") = rsExists("Conclusion")

Session("NTSSSkillset1") = rsExists("NTSSSkillset")

Session("NTSSTicketNo") = Request.QueryString("editid1")

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Customer: " & Session("Customer") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>SIMS Call ID: " & Session("SimsTicketNo") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Original Followup: " & Session("SLADateTime") & "</b></font>
"

Response.Write "<font size=1 color=""purple"" face=""Tahoma""><b>Date Pending (Resolved): " & Session("DateResolved") & "</b></font>
"

Response.Write "<hr size=2 align=center color=#85D633 width=""100%"">"

else
end if

rsExists.Close : set rsExists = Nothing

  • then use a session var as a default... You didn't specify how you would get a value from another table - is it based on primary key for example this query looks in another table based on the primary key of the current page / backend query

C
clig 6/26/2009

yes