0

I need to upsert into Car_Pref Data Extension which has email, Automobile, Make

If I am interested in SUV and Van I select the check boxes for Automobile. (101,103) Make - GM, Ford. (104,105)

@selection1 = (101,103) @selection2 = (104,105)

UpsertDE("Car_Pref",1, "Automobile", @selection1, "Make", @selection2)

Is it possible to insert coma separated values?

<form> 

  <table id="jb_table" align="center" cellpadding="0" cellspacing="0" border="0" width="800">
    <tr><td valign="top" height="10px"></td></tr>
      <tr>
        <td>
     <fieldset>
      <legend>Automobile</legend>
      <div>
        <input type="checkbox" id="100" name="Sedan" value="100">
        <label for="Sedan">Sedan</label>
      </div>
      <div>
        <input type="checkbox" id="101" name="SUV" value="101">
        <label for="SUV">SUV</label>
      </div>
       <div>
        <input type="checkbox" id="102" name="Truck" value="102">
        <label for="Truck">Truck</label>
      </div>
       <div>
        <input type="checkbox" id="103" name="Van" value="103">
        <label for="Van">Van</label>
      </div>

    </fieldset>   

        </td>
        <td>
        <fieldset>
      <legend>Make</legend>
      <div>
        <input type="checkbox" id="104" name="GM" value="104">
        <label for="GM">GM</label>
      </div>
      <div>
        <input type="checkbox" id="105" name="Ford" value="105">
        <label for="Ford">Ford</label>
      </div>
       <div>
        <input type="checkbox" id="106" name="Crysler" value="106">
        <label for="Crysler">Crysler</label>
      </div>


    </fieldset>
        </td>


      </tr>

     <div   id="divSelectedCounties" >

    <tr><td valign="top" height="10px"></td></tr>
      <tr>
        <td colspan="2" align="center" valign="top">
          <button type="Submit" name="Submit" value="0">SUBMIT</button>
        </td>
      </tr>
  </table>
</form>

1 Answer 1

0

Yes you can make use of Concat function to join two fields with comma separated values and insert into data extension.

Just remove the values in HTML. On submit you can check if it's not Null then you can set the values in ampscript.

Below is the sample code, its not completed fully but it will help you to get started.

%%[
IF RequestParameter("submitted") == "submitted"  Then
Set @Sedan = RequestParameter("Sedan")
Set @SUV = RequestParameter("SUV")
IF @Sedan != null THEN
Set @Sedan = "100"
ENDIF
IF @SUV != null THEN
Set @SUV = "101"
ENDIF
Set @output = concat(@Sedan,',',@SUV)
upsertDE ("Car_Pref",1, "Automobile", @output, "Make", @selection2)
ENDIF
]%%

<form> 

  <table id="jb_table" align="center" cellpadding="0" cellspacing="0" border="0" width="800">
    <tr><td valign="top" height="10px"></td></tr>
      <tr>
        <td>
     <fieldset>
      <legend>Automobile</legend>
      <div>
        <input type="checkbox" id="100" name="Sedan" value="">
        <label for="Sedan">Sedan</label>
      </div>
      <div>
        <input type="checkbox" id="101" name="SUV" value="">
        <label for="SUV">SUV</label>
      </div>
       <div>
        <input type="checkbox" id="102" name="Truck" value="">
        <label for="Truck">Truck</label>
      </div>
       <div>
        <input type="checkbox" id="103" name="Van" value="">
        <label for="Van">Van</label>
      </div>

    </fieldset>   

        </td>
        <td>
        <fieldset>
      <legend>Make</legend>
      <div>
        <input type="checkbox" id="104" name="GM" value="">
        <label for="GM">GM</label>
      </div>
      <div>
        <input type="checkbox" id="105" name="Ford" value="">
        <label for="Ford">Ford</label>
      </div>
       <div>
        <input type="checkbox" id="106" name="Crysler" value="">
        <label for="Crysler">Crysler</label>
      </div>


    </fieldset>
        </td>

      </tr>

     <div   id="divSelectedCounties" >

      <tr><td valign="top" height="10px"></td></tr>
      <tr>
        <td colspan="2" align="center" valign="top">
        <input id="submitted" name="submitted" type="hidden" value="submitted">
          <button type="Submit" name="Submit" value="0">SUBMIT</button>
        </td>
      </tr>
  </table>
</form>
1
  • Thank you. Sorry for my delay in the response. The regular request parameter does take the inputs as coma separated values and stores in one field. Concat should also work though.
    – tienar
    Jun 24, 2020 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .