Skip to main content
Solved

Trying to get part of description but getting syntax error missing )

  • January 9, 2024
  • 1 reply
  • 67 views

jlandrum
Apprentice
Forum|alt.badge.img

So we have form emails that come in. Trying to get a part of the description and this was working but now all of a sudden it keeps telling me that there is a syntax error. My expression is substring( "{{ticket.description}}", indexOf("{{ticket.description}}","Start Date",0)+12, indexOf("{{ticket.description}}","Previous Dealer",0)-5). The syntax error that it gives me is Invalid Syntax - Missing ). but it does the same if you just try to get the indexOf part. My expression builder is set to string and I have tried numbers as well. Any help would be appreciated.

Best answer by jlandrum

I figured it out. There was a quote ‘ in the description which was causing problems with the expression. I used liquid filter to remove the quote in the description. So my expression became

substring( "{{ticket.description | replace: "'",""}}", indexOf("{{ticket.description | replace: "'",""}}","Start Date",0)+12, indexOf("{{ticket.description | replace: "'",""}}","Previous Dealer",0)-5)

which seems to work.

View original
Did this topic help you find an answer to your question?

1 reply

jlandrum
Apprentice
Forum|alt.badge.img
  • Author
  • Apprentice
  • 1 reply
  • Answer
  • January 9, 2024

I figured it out. There was a quote ‘ in the description which was causing problems with the expression. I used liquid filter to remove the quote in the description. So my expression became

substring( "{{ticket.description | replace: "'",""}}", indexOf("{{ticket.description | replace: "'",""}}","Start Date",0)+12, indexOf("{{ticket.description | replace: "'",""}}","Previous Dealer",0)-5)

which seems to work.


Reply