PDF Template: how to check textfield (255 charakters) if empty?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ManfredWinter
    Junior Member
    • Dec 2025
    • 7

    #1

    PDF Template: how to check textfield (255 charakters) if empty?

    Hello everyone,

    in my deals entitiy I have up to 4 cameras and each of the cameras has an own textfield (255 charakters) for the name of the camera. In espocrm the English name of this textfield is "Varchar".

    In my PDF Template I want to check if this field is empty - for example when there are only 2 cameras used, than the name of camera 3 and 4 is empty.

    I tried it for camera 2 as an example with:

    {{#ifNotEqual cResourceCamera2Name ""}}

    but this doesnt work. How is it possible to check a textfield if it is empty?

    Thank you very much
    kind regards
    Manfred
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1809

    #2
    As I understand, you want to display only fields, which are not empty, right?
    This you may resolve with a simple if statement

    as

    {{#if camera1}} {{fieldname of that varchar camera1}} {{/if}}
    {{#if camera2}} {{fieldname of that varchar camera2}} {{/if}}

    This causes, that the field content of the field-placeholder is only displayed, if it is not empty.

    Obs.: the if-statement put in the Code View of the HTML and set it into HTML-Comment (<!-- {{#if camera1}} {{fieldname of that varchar camera1}} {{/if}} -->)

    Comment

    • heint
      Member
      • Jun 2025
      • 57

      #3
      Greetings, ManfredWinter,

      Use this code snippet instead:
      Code:
      {{#if cResourceCamera2Name}}
      Camera 2: {{cResourceCamera2Name}}
      {{/if}}
      You can use the #each iterator for multiple identical values, but this will be a bit harder to implement.

      This will check and execute only if cResourceCamera2Name field value is not empty.

      Comment

      Working...