Display data into add-on template, which is attached to the main one with the help of pdf-utils



  • Hello, could you please tell me how to display data into add-on template, which is attached to the main one with the help of pdf-utils?

    I have a main template, to which I am attaching with the help of pdf-utils the following templates:

    0_1603350459784_upload-4d7cd0ae-d239-40b4-9d4c-516dddf2f918

    In Watermark template I am trying to display the value, I am receiving from the query below:

    0_1603350502064_upload-e39a9218-da64-42dc-96d6-b9a1a65e2682

    0_1603350534098_upload-a871ac89-a30f-4b24-8706-c36756294e65

    On the start this error takes place:
    0_1603350571130_upload-a70e8c70-584c-46c3-8acd-3fbe79e661f3

    The same problem is occurring in Footer template, when the value is dispayed in footer:

    0_1603350623984_upload-4ebf76c2-f199-48f0-9a57-a76e72cc134c

    But in that case I was able to get the data by addressing to a parent query, which is attached as a source data to "TestConstr" template:

    0_1603350668611_upload-03b719ed-3f60-4298-be5d-2b5fee41edb1

    And in this case, when I am following the same logic, it is just ignores and does not display any of data, also not showing any errors or warnings:

    0_1603350696297_upload-3e42e549-9aca-439d-97c0-db2e6a81a59d

    0_1603350726790_upload-7bcd918a-9418-4a40-8873-aa10b5a8529b

    I am inserting new #each into #each to get this result ( last column should be dependent from the amount of unified rows, that’s why I need to insert into the colspan the value that comes from query):
    0_1603350751727_upload-1c56cdb0-aec0-4052-a3eb-d57ef6ace338



  • Hi,
    Let's isolate the problem and look at the watermark.
    The pdf utils send the same data to the append operation as was the original input data to the main template.
    In case you use the "Sample data" as you do on the screen, it will be the same.
    This means you can attach the same sample data to the watermark and you should observe the same error if you run standalone watermark. Right?
    Now the problem is likely in the handlebars calls you do, but it is very hardly readable on screens.
    The best would be if you would take just the watermark template and sample data and replicate the problem in the playground.
    Then we can take a quick look and hopefully help.



  • Posted the template on the site:
    https://playground.jsreport.net/w/ruslan.ahmetvaleev/Nh5W2yHK

    but i don't know how to create data source ..



  • Yes, that is incomplete when we cannot run the template and see the error....

    However, I see you use this construct

     {{#each items.[4]}}   
            <tr>
              <td style = "text-align: left; width:14%" rowspan = {{strCount}}  class="photo" ><img src="{#asset logoRedBur.png @encoding=dataURI}" width="100" height="150"/></td>
              <td style = "text-align: left; width:33%"></td>
              <td style = "text-align: left; width:13%"></td>
              <td style = "text-align: left; width:25%"></td>
            {{#each items.[5]}}
              <td style = "text-align: left; width:10%;" rowspan = {{strCount}}>{{ItogEDO}}</td>
            {{/each}}
            </tr>
        {{/each}}
    

    This means you take the array that is on items[4] and then you take the array that is on items[4][x][items[5] and do each again.
    Do you really want this? Is it clear that when you are inside the each, the context (this) is the particular item?
    Maybe this topic helps https://stackoverflow.com/questions/12297959/access-properties-of-the-parent-with-a-handlebars-each-loop



  • Array items[4] returns in my case a number for rows unification. array items [5] returns data on if digital signature is correct or not. I am putting #each in #each to display items[5] value in unified column, which uses colspan property comming from items[4], so colspan ={{strCount}}.

    This may not be the right approach, but I don’t know how to concatenate a column using the colspan parameter outside of #each yet. And then insert into the table the value from the items [5] array..

    Thanks for the help, I will understand further.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.