Replace related values *Tags

Friends, I have a field with tags, I want to replace the id of the tags with the name of the value from a database, how can I replace all the values of the tags?

Table relation (Values)

ID Name
1 Red
2 Blank

TextField.Text = “</1/></2/>”

Result:
TextField.Text = “Red, Blank”

textfield.text=replaceall(textfield.text,"</1/>",rs.field("field1").stringvalue)
textfield.text=replaceall(textfield.text,"</2/>",rs.field("field2").stringvalue)

This code is for illustration purposes only, and should be modified by the developer to fit their particular circumstance

Dave’s example if where the tags are in a single record. In your case, you’d loop through the RecordSet and replace each “/#/” with the value of that record. I’m unclear if the placeholders correspond to record ID’s, as it appears, or merely counters.

dim rs as RecordSet = db.SQLSelect( "SELECT * FROM values" )
dim s as string = TextField.Text
while not rs.EOF
  dim id as integer = rs.Field( "ID" ).IntegerValue
  dim name as string = rs.Field( "Name" ).StringValue
  s = s.ReplaceAll( "/" + str( id ) + "/", name )
  rs.MoveNext
wend
TextField.Text = s

What he said. :slight_smile:

Grateful friend!