taking an unkown value and assigning it a value

Results 1 to 2 of 2

Thread: taking an unkown value and assigning it a value

  1. #1
    Join Date
    Dec 1969

    Default taking an unkown value and assigning it a value

    I want to take the value of this code:<BR><BR>&#060;td width="19%"&#062;&#060;%=(Recordset1.Fields.Item(" test unit ").Value) %&#062;&#060;/td&#062;<BR>this is from an asp page recordset of a sql database. The values that are displayed are like " mcmasa02" and " mcmado01". These values show on my ASP page in a table just fine. However I want to change these values to a better descriptive name. So I&#039;m trying to write the code that will take the value of =(Recordset1.Fields.Item(" test unit ").Value) %&#062; which will be something like "mcmasa02 and make the table display say " Master 02 " any ideas?

  2. #2
    Join Date
    Dec 1969

    Default misleading subject...

    Nothing "unknown" about any of this. But okay...<BR><BR>&#060;%<BR>Do Until Recordset1.EOF<BR>&nbsp; &nbsp; &#039; do you *really* have spaces in field name????<BR>&nbsp; &nbsp; temp = Recordset1.Fields(" test unit ").Value <BR>&nbsp; &nbsp; &#039; from the examples you showed, I presume that those<BR>&nbsp; &nbsp; &#039; values are all of the form xxxxxxNN where xxxxxx is<BR>&nbsp; &nbsp; &#039; some sort of prefix and NN is some number?<BR>&nbsp; &nbsp; &#039; if so...<BR>&nbsp; &nbsp; prefix = Left( temp, 6 )<BR>&nbsp; &nbsp; idnum = Right( temp, 8 )<BR>&nbsp; &nbsp; Select Case prefix<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case "msmasa"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = "Master " & idnum<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case "mcmado"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = "Maddening " & idnum<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case ...<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<BR>&nbsp; &nbsp; &nbsp; &nbsp; Case Else<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = "Undecoded: " & temp<BR>&nbsp; &nbsp; End Select<BR>&nbsp; &nbsp; ...<BR>&nbsp; &nbsp; Response.Write "&#060;TD&#062;" & temp & "&#060;/TD&#062;" & vbNewLine<BR>&nbsp; &nbsp; ...<BR>&nbsp; &nbsp; Recordset1.MoveNext<BR>Loop<BR>...<BR>%&#062;<BR>< BR>Adapt that "translation" to whatever reality is in your system.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts