Form page:

    set @travelinterest= RequestParameter("tli")

    set @favouritebcdestination = RequestParameter("bcd")

    set @email = "testingprupose1@gmail.com"


Amp script :


VAR @email, @acts, @acts2, @acts3, @cnt_product

SET @rowset = LookupRows("DENAME","Email","somemail@gmail.com")
SET @row = Row(@rowset, 1)

set @email = "somemail@gmail.com"
set @act = Field(@row,"DENAME")

set @productrowset = BuildRowsetFromString(@act,";")
FOR @cnt_product = 1 to RowCount(@productrowset) Do
set @record_product = Field(Row(@productrowset,@cnt_product),1)

IF @record_product == "Arts" or  @record_product == "Culture and Historical Experiences" THEN

     SET @var1 = "Arts"
     SET @var2 = "Culture and Historical Experiences"
     SET @record_product = Concat(@var1, "," , @var2)

IF @record_product == "Aboriginal Culture and Experiences" THEN
SET @acts = "checked"

ELSEIF @record_product == "Arts,Culture and Historical Experiences" THEN
SET @acts1 = "checked"

SET @acts12 = "checked"

Next @cnt_product


In form page the values are displayed in three checkbox like:

  1. Aboriginal Culture and Experiences
  2. Arts,Culture and Historical Experiences
  3. Driving Vacations

below that submit button will be there?

after clicking the checkbox the values are inserted in data extension in one field, each value is seperated by comma by default functionality, so i dont want comma, i am replacing the comma value using semicolon with the help of replace function, but in second checkbox arts after comma is there, while using replace function that comma also replacing, how to avoid that comma?please guide with code

I have tried with this:

set @p = "\s\,+\s\"
set @m = RegExMatch(@travelinterest,@p,0,"IgnoreCase")
set @o = replace(@travelinterest,@m," ;")

but it is not working,please anyone guide me ANSWER

  • so basically you want all commas except the one in "Arts,Culture..." to be replaced with a semi-colon? – Gortonington Jun 28 '17 at 12:51
  • yes you are right @Gortonington,no i want to replace semicolon, except arts,culture – SFDC Jun 28 '17 at 12:52

This may not be the most elegant solution, but you could do the following:

Replace(Replace(@travelinterest,",",";"), "Arts;Culture", "Arts,Culture")

This will solve your immediate need. Otherwise if you needed something a bit more robust so you don't need to add a new replace function each time you need an exception, you can have it insert another unique symbol, like ` or ~ into the parts you want to retain the comma and then use the following:

e.g. use below for your concat:

SET @record_product = Concat(@var1, "~" , @var2)

and this for your replace:

Replace(Replace(@travelinterest,",",";"), "~", ",")

Which will replace all tilde's with commas after the other commas were changed to semi-colons.

I am sure there is a much more elegant solution out there via RegEx, but I don't know it and it may be much too complex for the simple issue you are having.

  • Replace(Replace(@favouritebcdestination,",",";"), "Arts;Culture", "Arts,Culture") it is not working – SFDC Jun 28 '17 at 13:21
  • looks like (judging from your RegEx sample), it should be @travelinterest. I will update my answer with that variable. – Gortonington Jun 28 '17 at 15:14
  • i just need one clarification @Gortonington – SFDC Jun 28 '17 at 15:19
  • I am not sure what your previous comment means @SFDC – Gortonington Jun 28 '17 at 16:18
  • please help me for this - salesforce.stackexchange.com/questions/180988/… – SFDC Jun 28 '17 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.