Docmerge displaying if and else tags

Hiya, 

I am creating a docmerge template with a lot of if/else conditions using || for or and && for and conditions in it. I am testing in sections and have noticed that the if/else isnt working and the if and else tags are being left in the rendered document. Is there something wrong in the coding i have set up? or is this a bug? Screenshot below of the codeing on the left and result on the left.

Parents
  • Hi Ross, there are a couple of syntax issues in your example. If you fix these, it might resolve the weird behavior you're seeing:

    1. {else if} should actually be {elseif} with no space.
    2. The proper formatting for && and || is as follows:
      1. {if cladding_c == "Rendered" || cladding_c == "Plastered"} (and likewise for the other condition with || in your example)

    As a side note, you should also only use straight quotes, not "smart quotes" that some word processors use. It appears that you are using straight quotes in your example, but I thought I'd mention it just in case!

    If you make those changes, does that clear up the unexpected output?

    -Brenda

Reply
  • Hi Ross, there are a couple of syntax issues in your example. If you fix these, it might resolve the weird behavior you're seeing:

    1. {else if} should actually be {elseif} with no space.
    2. The proper formatting for && and || is as follows:
      1. {if cladding_c == "Rendered" || cladding_c == "Plastered"} (and likewise for the other condition with || in your example)

    As a side note, you should also only use straight quotes, not "smart quotes" that some word processors use. It appears that you are using straight quotes in your example, but I thought I'd mention it just in case!

    If you make those changes, does that clear up the unexpected output?

    -Brenda

Children
  • Well that is annoying. i should have known that!!!! ill give them a go and let you know the outcome!

  • I have updated the text and now get a different issue. I have pasted the text below to check formatting. I am now getting Error: Unexpected token '||'. I have another DocMerge issue as well but ill post a new question.

    {#surv_survey_quotes_1}

    {if cladding_c == "Ship Lap" || "Vertical Tile" || "Rendered" || "Plastered"}The property has a {cladding_c} finish on the external façade. The cladding was in {lbl_cladding_condition_c} at the time of the survey. {endif}

    {if cladding_c == "Rendered" || "Plastered"}Due to the nature of the external cladding on the property, there is a possible risk of damage due to core drilling.{elseif cladding_c == "Shiplap" || "Vertical Tile"} Due to the nature of the external cladding on the property, CUSTOMER may require a section to be removed local to the external termination prior to commencing the installation work. We would ask that you arrange to have the cladding removed prior to our visit and then re-instated around the external termination following the completion of the installation work.{endif}

    {if extra_drilling_c == "Yes"}Due to the construction of the property, there may be an additional cost for extra drilling as itemised below. This additional cost will only be charged where relevant and will be based on the extra time taken to complete the drilling. {endif}

    {/surv_survey_quotes_1}