Invio ciclo PDFMonkey

Sorry if I’m still here to take advantage of your knowledge but unfortunately I have two problems:
I wanted to create a PDF with PDFMonkey integration where I have a series of rows divided into 4 tables depending on some fields
Problem 1:
when I send a boolean field glide sends it as a string
Problem 2 (even if it could be solved when the first is solved)
Glide only sends me the first row of data
Do you have any advice? Should I leave integration alone and go through Make?Thanks
Monkey’s json test works perfectly

1 Like

I think this has been a thing for a while, I don’t typically send booleans but I can confirm it sends strings when I use JSON arrays.

It shouldn’t be a big problem for you though. You can assign a new variable based on the input variable, something like this.

{% if input_variable == "true" %}
  {% assign is_active = true %}
{% else %}
  {% assign is_active = false %}
{% endif %}

That shouldn’t be the case, you should be able to send JSON arrays over, but you have to parse the input inside PDFMonkey before being able to work with it as an array. Can you show me how you’re configuring it?

1 Like
{% assign pranzo = menu | where: "Pasto", "Pranzo" %}
{% assign cena = menu | where: "Pasto", "Cena" %}
{% assign cena_turno2 = menu | where: "Secondo_Turno", true %}
{% assign colazione = menu | where: "Pasto", "Colazione" %}

<!-- PRANZO -->
<h2>PRANZO</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <thead>
    <tr>
      <th>Nome</th>
      <th>Primo</th>
      <th>Secondo</th>
      <th>Contorno</th>
      <th>Pizza</th>
      <th>Insalatona</th>
      <th>Note</th>
    </tr>
  </thead>
  <tbody>
    {% for persona in pranzo %}
      <tr>
        <td>{{ persona.Nome }}</td>
        <td>{{ persona.Primo }}</td>
        <td>{{ persona.Secondo }}</td>
        <td>{{ persona.Contorno }}</td>
        <td>{{ persona.Pizza }}</td>
        <td>{{ persona.Insalatona }}</td>
        <td>{{ persona.Note }}</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

<div style="page-break-after: always;"></div>

<!-- CENA -->
<h2>CENA</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <thead>
    <tr>
      <th>Nome</th>
      <th>Primo</th>
      <th>Secondo</th>
      <th>Contorno</th>
      <th>Pizza</th>
      <th>Insalatona</th>
      <th>Note</th>
    </tr>
  </thead>
  <tbody>
    {% for persona in cena %}
      {% if persona.Secondo_Turno != true and persona.Secondo_Turno != "true" %}
        <tr>
          <td>{{ persona.Nome }}</td>
          <td>{{ persona.Primo }}</td>
          <td>{{ persona.Secondo }}</td>
          <td>{{ persona.Contorno }}</td>
          <td>{{ persona.Pizza }}</td>
          <td>{{ persona.Insalatona }}</td>
          <td>{{ persona.Note }}</td>
        </tr>
      {% endif %}
    {% endfor %}
  </tbody>
</table>

<div style="page-break-after: always;"></div>

<!-- CENA – SECONDO TURNO -->
<h2>CENA – SECONDO TURNO</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <thead>
    <tr>
      <th>Nome</th>
      <th>Primo</th>
      <th>Secondo</th>
      <th>Contorno</th>
      <th>Pizza</th>
      <th>Insalatona</th>
      <th>Note</th>
    </tr>
  </thead>
  <tbody>
    {% for persona in cena_turno2 %}
      <tr>
        <td>{{ persona.Nome }}</td>
        <td>{{ persona.Primo }}</td>
        <td>{{ persona.Secondo }}</td>
        <td>{{ persona.Contorno }}</td>
        <td>{{ persona.Pizza }}</td>
        <td>{{ persona.Insalatona }}</td>
        <td>{{ persona.Note }}</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

<div style="page-break-after: always;"></div>

<!-- COLAZIONE -->
<h2>COLAZIONE</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <thead>
    <tr>
      <th>Nome</th>
      <th>Caffetteria</th>
      <th>Succo</th>
      <th>Colazione</th>
      <th>Gusto</th>
      <th>Note</th>
    </tr>
  </thead>
  <tbody>
    {% for persona in colazione %}
      <tr>
        <td>{{ persona.Nome }}</td>
        <td>{{ persona.Caffetteria }}</td>
        <td>{{ persona.Succo }}</td>
        <td>{{ persona.Colazione }}</td>
        <td>{{ persona.Gusto }}</td>
        <td>{{ persona.Note }}</td>
      </tr>
    {% endfor %}
  </tbody>
</table>
{
      "Nome": "Giulia Verdi",
      "Pasto": "Cena",
      "Primo": "Pasta al Pomodoro",
      "Secondo": "Cotoletta",
      "Contorno": "Patate",
      "Pizza": "Margherita",
      "Insalatona": "Tonno",
      "Caffetteria": "Cappuccino",
      "Succo": "Mela",
      "Colazione": "Cornetto",
      "Gusto": "Tradizionale",
      "Note": "Ben cotta",
      "Secondo_Turno": true
    },
    {
      "Nome": "Marco Neri",
      "Pasto": "Pranzo",
      "Primo": "Pasta al Pomodoro",
      "Secondo": "",
      "Contorno": "Zucchine",
      "Pizza": "",
      "Insalatona": "Con Tonno",
      "Caffetteria": "Caffè",
      "Succo": "Arancia",
      "Colazione": "",
      "Gusto": "",
      "Note": "",
      "Secondo_Turno": false
    },
    {
      "Nome": "Sofia Bianchi",
      "Pasto": "Pranzo",
      "Primo": "Penne Arrabbiata",
      "Secondo": "",
      "Contorno": "",
      "Pizza": "Margherita",
      "Insalatona": "Vegetariana",
      "Caffetteria": "",
      "Succo": "Mela",
      "Colazione": "",
      "Gusto": "Vegetariano",
      "Note": "Senza sale",
      "Secondo_Turno": false
    }
  ]
}

Sorry if I’m messing up a bit but I’m a beginner and I’m trying to learn as much as possible. On Monkey everything works but when I send the data from glide first it sends me only one row second the table doesn’t fill up. If I copy and paste the data sent from glide on the monkey test it works. I’m going crazy

How are you configuring that variable in the PDFMonkey integration? Can you show me that as well?

In the logs, you can also see how Glide sends the variable to PDFMonkey. There should be an extra parse for JSON arrays if you’re doing it that way, but I want to see if you’re configuring the variable correctly first.

Thank you for your help but I think I will have to give up (maybe I’m too old for these things) I’ve been trying for days both directly from glide and from google sheet with Make but unfortunately I can’t get anywhere. The PDFMONKEY configuration HTML works perfectly with the json test but I got to that point and then total darkness. :sos_button: At this point I could share the google sheet, the html and the json with someone who can create the various phases with Make to create pdf with MONKEY so maybe I can understand something. Thanks :folded_hands:


directly from glide

That looks like you’re only passing info from the “current row” to PDFMonkey.

Assuming you want to pass multiple rows, you should:

  • Create a JSON structure for each row.
  • Have a relation/query to get all the related rows.
  • Have a joined list + template column to construct the JSON array. The output should look like this:
[
  {
    "Nome": "Mario Rossi",
    "Pasto": "Pranzo",
    "Primo": "Pasta al Pomodoro",
    "Secondo": "Pollo",
    "Contorno": "Insalata",
    "Pizza": "",
    "Insalatona": ""
  },
  {
    "Nome": "Luca Bianchi",
    "Pasto": "Cena",
    "Primo": "Risotto",
    "Secondo": "Pesce",
    "Contorno": "Patate",
    "Pizza": "Margherita",
    "Insalatona": ""
  },
  {
    "Nome": "Giulia Verdi",
    "Pasto": "Colazione",
    "Primo": "",
    "Secondo": "",
    "Contorno": "",
    "Pizza": "",
    "Insalatona": "",
    "Caffetteria": "Cappuccino",
    "Succo": "Arancia",
    "Colazione": "Cornetto",
    "Gusto": "Cioccolato",
    "Note": ""
  },
  {
    "Nome": "Anna Neri",
    "Pasto": "Cena",
    "Primo": "Gnocchi",
    "Secondo": "Carne",
    "Contorno": "Verdure",
    "Pizza": "",
    "Insalatona": "Mista",
    "Secondo_Turno": true,
    "Note": "Vegetariana"
  }
]

Then, pass that as a single variable to PDFMonkey. Parse it over there like this, in my case this was a table and the example assumes the JSON array is named “orders”.

{% assign parsed_orders = orders | parse_json %}

{% for item in parsed_orders %}
<tr>
  <td>{{ item.Nome }}</td>
  <td>{{ item.Pasto }}</td>
  <td>{{ item.Primo }}</td>
  <td>{{ item.Secondo }}</td>
  <td>{{ item.Contorno }}</td>
  <td>{{ item.Pizza }}</td>
  <td>{{ item.Insalatona }}</td>
  <td>{{ item.Caffetteria }}</td>
  <td>{{ item.Succo }}</td>
  <td>{{ item.Colazione }}</td>
  <td>{{ item.Gusto }}</td>
  <td>{{ item.Note }}</td>
  <td>{{ item.Secondo_Turno }}</td>
</tr>
{% endfor %}
1 Like