Announcement

Collapse
No announcement yet.

pdf each in each

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • pdf each in each

    Hi, I want to do pdf template for case:



    Case name:{{name}}<br>

    Accounts:<br>

    {{#each accounts}}
    Account name:{{name}}<br>

    {{#each contacts}} // of course in listed account
    Contact name:{{name}}<br>
    {{/each}}
    <br>
    {{/each}}


    but i cant go deeper than 1 level.
    is it normal that each in each not work or some mistake from me??

    thank you

  • #2
    Hello,
    {{#each}} iterator supports the link-multiple relationship. By default the Case entity has:
    1. Many-to-One relationship with Account
    2. Many-to-Many relationship with Contacts

    So if you are using the default relationships then in your case for Contacts it will work, but will not for Account. For Account you need to utilize a simple Placeholder instead - {{accountName}}.

    Comment


    • #3
      ok it is wrong example from me - sorry
      i can make another better example

      protocol (many to many) relation to case
      case(many to many) relation to usedSpareParts

      this mean that protocol have 1 or more linked cases
      and every case have included count of usedSpareParts

      i need print in protocol with all linked cases
      and all usedSpareParts separated according to cases

      this is why i ask each in each

      -------------------------------------
      protocol: 01
      customer: john
      cases:
      - case no 1
      - repair wheel
      - usedSpareParts:
      -- 1x wheel
      -- 1x bearing
      - case no 4
      - repair mirror
      - usedSpareParts:
      -- 1x mirror

      etc...
      --------------------------------------

      dash mean depth of each cycle

      my problem is pdf {{#each ...}} use as recursing function

      thank you

      wbr. .s.

      Comment


      • #4
        its maybe only problem formating of variable like>

        Protocol:{{name}}<br>
        Cases:<br>
        {{#each cases}}
        Case name:{{name}}<br>
        Used spareparts:
        {{#each usedSpareParts}}
        {{name}}<br>
        {{/each}}
        <br>
        {{/each}}

        ?!? more complex locks {{{{name}}}}
        or some prefix before {{usedSpareParts.name}} ?!?
        i thing it´s only some little mistake why not work recursion

        Comment


        • #5
          Hello,

          i think you or me don't understand..
          you say pdf for case..

          so you can only (!) have a case.. and case have only one parent ..

          maybe you need to do pdf for account and then forEach case ?

          Comment


          • #6
            i am trying make pdf template .
            so printing all cases is not problem (it work good and i have the same solution for meetings)
            but in cases i cant generate to pdf used parts (screenshots may help with understanding)
            for the printing cases and meetings is used helper {{/each}}

            but i need for spareparts use {{/each}} in {{/each}} - it not work

            this is only generating pdf via template problem
            structure of listing and inserting data is not problem

            Comment


            • #7
              Ha ok,

              you pdf (entity template =) Protocol !!! so you go 2 depth ..
              not possible out-of-box (for me)... need custom code

              if you pdf (entity template = Case) .. then you can each spareParts and too have protocoleName

              Comment


              • #8
                one of way is :
                make custom helper with direct sql query and incuding iterations. With this helper generate "used spare part as html table" outside of pdf temlpate (directly in helper)
                so this is not ideal complex solution, but it is only about transfering problem from one scripting language to another.

                PS> (worst but working can be create in "case entity" columns: sparepart1, sparepart2 .... and forward data thru that columns, but sorry - noway for me)

                thanks

                wbr. -s-

                Comment


                • esforim
                  esforim commented
                  Editing a comment
                  Multi level would be good wouldn't it. Unfortunately it is probably will never be supported in default installation.
              Working...
              X