PDA

View Full Version : Displaying field


pwgeary
06-13-2003, 11:04 AM
I have a record and one of the fields in this record is feature.
Feature:
A04B02C04D01E01F01G01H01I01J09K01M05N02N08N14O01P13P15P17P18P01P05P07P02P10Q02Q05Q09Q10Q11Q15Q17Q24R07S01T06U10V01V03V09V10W04W05W06W07W08W10L01


Feature:
A03B07C02D03D07E02F01G04H02I01J04K06L07L01M01M06N05N13O01R02S02S05T06V01V03W04W05W06

As you can see they can vary in length. How it works is the letter mean what category it is and the number that follows is what the specific item is. So every 3 characters is a new feature for that record. So record 1 has feature A04 and B02 and C04 . . .

A= Color
B = Style
C = Layout
A04 = Red
B02 = Flat
C04 = open



I don't need to search by this, I just wnat to display this. The category is a table, the Specific item is a table. Any ideas would be helpful.
Thanks, Paul

jsawkang
06-15-2003, 07:15 AM
hi...

how, ur data is stored in feature table anyway? it's all in 1 field? or everytime new feauture is added, new row/record created in the feature table?

pwgeary
06-15-2003, 01:53 PM
the featured field is all one field. When updates are made a new record is made and the old one is deleted.

Whitesword
06-16-2003, 07:49 AM
A not very nice solution (but it will work) is a massive jump table (using SELECT statements)

FieldLen = Len(Feature)
StartPoint=0
While StartPoint < FieldLen
'Work on the characteristic (This gets the A,B,C,....)
SELECT CASE Mid(Feature,StartPoint,1)
CASE "A"
'Now do the characteristic type
SELECT CASE Mid(Feature,StartPoint+1,2)
CASE "00"
Response.Write( "Black,")
CASE "01"
....
CASE ELSE
END SELECT
CASE "B"
.....
CASE ELSE
'Do Nothing
END SELECT
StartPoint=StartPoint+3
Wend

As I said, not very nice and rather long winded, but given the method it's the only way...

Have you though about setting up another table called features that is indexed on your item that just lists the features and just use an SQL statement to get the features and just work through that record set? Would involve much less coding outputting it would be a breeze

set rs=dbConn.Execute( "SELECT fldFeature FROM Features WHERE ItemID='" & ItemID & "'")
While Not rs.EOF
Response.Write(rs(0) & ", ")
rs.MoveNext
Wend
Set rs=Nothing

pwgeary
06-16-2003, 04:40 PM
thanks for your help. That is what i came up with as well, but as you said it is kind of long winded. As far a the set up. I get my data from another database and there is not much i can do about how it is set up. Thanks again
paul

fyrye
06-16-2003, 06:00 PM
You could make a function to use this specifically instead of calling from a database everytime.
Would be a pain but would be more customizable.
ie getting each setting you want to use by doing len and mid / left / right.

I did to make a placement ie 1st 2nd 3rd 4th 22nd etc. goes all the way up to 999th