# Trouble with #compare handlebar

**URL:** <https://connective.celigo.com/t/trouble-with-compare-handlebar/1156>\
**Category:** Integrator.io\
**Tags:** error-handling, handlebars, javascript\
**Created:** [March 25, 2021, 10:40pm UTC](https://connective.celigo.com/t/trouble-with-compare-handlebar/1156 "2021-03-25T22:40:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![coryanderson215](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@coryanderson215](https://connective.celigo.com/u/coryanderson215)\
**Post date:** [March 25, 2021, 10:40pm UTC](https://connective.celigo.com/t/trouble-with-compare-handlebar/1156/1 "2021-03-25T22:40:43Z")

</div>

I'm trying to build a handlebar statement that compares 2 fields, and if they are equal, then return a field.

{{#compare [L5[\*].ORDERED PART] "===" [L5[\*].SHIPPED PART]}}{{L5[\*].SHIPPED PART}}{{/compare}}

This is the error:

"Could not compile handle bar \"{{#compare [L5.[0].ORDERED PART] \"===\" [L5.[0].SHIPPED PART]}}{{L5[\*].SHIPPED PART}}{{/compare}}\" because \"Parse error on line 1:\n...are [L5.[0].ORDERED PART] \"===\" [L5.[0].\n-----------------------^\nExpecting 'CLOSE\_RAW\_BLOCK', 'CLOSE', 'CLOSE\_UNESCAPED', 'OPEN\_SEXPR', 'CLOSE\_SEXPR', 'ID', 'OPEN\_BLOCK\_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID'\" .Please correct and retry"

Any ideas on how to get this to work?

---

<div class="post-metadata">

**Author:** ![coryanderson215](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@coryanderson215](https://connective.celigo.com/u/coryanderson215)\
**Post date:** [March 25, 2021, 11:06pm UTC](https://connective.celigo.com/t/trouble-with-compare-handlebar/1156/2 "2021-03-25T23:06:28Z")

</div>

Update on this - changed the expression to:

{{#compare L5[\*].ORDERED PART "==" L5[\*].SHIPPED PART}}{{L5.[\*].SHIPPED PART}}{{/compare}}

Now the error is:

"Could not compile handle bar \"{{#compare L5.[0].ORDERED PART \"==\" L5.[0].SHIPPED PART}}{{L5.[\*].SHIPPED PART}}{{/compare}}\" because \"helper {{compare}}: invalid operator: `undefined`\" .Please correct and retry"

---

<div class="post-metadata">

**Author:** ![katelarson](https://avatars.discourse-cdn.com/v4/letter/k/91b2a8/32.png) [@katelarson](https://connective.celigo.com/u/katelarson)\
**Post date:** [March 26, 2021, 3:27pm UTC](https://connective.celigo.com/t/trouble-with-compare-handlebar/1156/3 "2021-03-26T15:27:34Z")

</div>

Hi @coryanderson215,

Thanks for posting to the community! I checked with one of our handlebars experts. He says the issue is that you're using wildcards in your expression. You'll need to specify the exact indices for the values you want to match. I hope that helps!
