Compare Handlebar Help!

Comments

3 comments

  • Lakhan Bhagnani Integration Engineer
    Answer Pro

    Hey Dave,

    {{#compare record.Form.Id '===' '314'}}BrokerageHouse
    {{else compare record.Form.Id '===' '254'}}BrokerageHouse
    {{else compare record.Form.Id '===' '253'}}BrokerageHouse
    {{else compare record.Form.Id '===' '278'}}BrokerageHouse
    {{else compare record.Form.Id '===' '277'}}BrokerageHouse
    {{else compare record.Form.Id '===' '336'}}BrokerageHouse
    {{else compare record.Form.Id '===' '334'}}BrokerageHouse
    {{else compare record.Form.Id '===' '257'}}BrokerageHouse
    {{else compare record.Form.Id '===' '256'}}BrokerageHouse
    {{else compare record.Form.Id '===' '267'}}BrokerageHouse
    {{else compare record.Form.Id '===' '268'}}BrokerageHouse
    {{else compare record.Form.Id '===' '275'}}BrokerageHouse
    {{else compare record.Form.Id '===' '274'}}BrokerageHouse
    {{else compare record.Form.Id '===' '318'}}BrokerageHouse
    {{else compare record.Form.Id '===' '288'}}BrokerageHouse
    {{else compare record.Form.Id '===' '287'}}BrokerageHouse
    {{else compare record.Form.Id '===' '237'}}BrokerageHouse
    {{else compare record.Form.Id '===' '240'}}BrokerageHouse
    {{else compare record.Form.Id '===' '272'}}BrokerageHouse
    {{else compare record.Form.Id '===' '271'}}
        BrokerageHouse
    {{else}}NonBrokerageHouse
    {{/compare}}

    Note: Use Strict check only if you know the data coming is going to match the data type.

    The structure of data, I assumed is as below:

    {
      "record":{
      "Form":{
      "Id": "123"
    }
    }
    }

    To understand more about Compare with else check out our docs here

    0
  • David Gollom Strategic Partner
    Top Contributor
    Celigo University Level 4: Legendary
    Answer Pro
    Great Answer
    Engaged

    Hey Dave - 

    You may also want to try the #contains helper...  It acts like a string search when you give it a literal. 

    For example try this in the playground

    Context:

    {
      "id": 125,
      "name": "Bob",
      "age": 33
    }

    Formula:

    {
       {{#contains "123*546*556*125" id}}yes{{else}}no{{/contains}}
    }

    1
  • Matthew Foran

    David Gollom brilliant!

    0

Please sign in to leave a comment.