This is going to be a long one.
From the get-go, the data I’m using is protected, so I can only share snips.
At a high level, I’m using a PDF.co API to take a PDF uploaded into Bubble and return JSON data extracted from the file.
This is achieved by using the Bubble URL (appended to https:) and passing that to the API, which then applies a template and returns just the data I want in a JSON format.
The response from the POST includes a URL to the JSON file, which I store in a separate database. Once that URL is detected a backend workflow picks up the import steps and triggers a loop that adds a new row of data for each row in the table contained within the JSON file.
As I referenced in my first post, I encountered an issue with the way Bubble imports JSON data as it doesn’t properly parse “field” data types (at least for me) and so I had to include my data as a “table” data type, even though it’s a single string. Using this approach I was able to get everything into Bubble.
The main bulk of the data is using the same structure as below, but in one table and all works as expected. These tables are added to the JSON file by PDF.co as new tables. I am not aware of a way to integrate the weekNum and yearNum values into the main table.
{
"id": 1716624824019,
"objectType": "table",
"name": "weekNum",
"tableProperties": {
"start": {
"y": 49.380145278450364,
"pageIndex": 1,
"expression": null
},
"end": {
"y": 68.07748184019371,
"pageIndex": 1,
"expression": null
}
"columns": [
{
"name": "weekNum",
"dataType": "string"
}
],
"left": 544.1332288401254,
"right": 558.0423197492163
}
},
{
"id": 1716624861851,
"objectType": "table",
"name": "yearNum",
"tableProperties": {
"start": {
"y": 48.42130750605327,
"pageIndex": 1,
"expression": null
},
"end": {
"y": 68.55690072639226,
"pageIndex": 1,
"expression": null
}
"columns": [
{
"name": "yearNum",
"dataType": "string"
}
],
"left": 563.7978056426332,
"right": 589.217868338558
}
}
The looping backend workflow adds a new row with the data from the JSON table.
I also added weekNum and yearNum on the assumption that they would be added to each row like the rest of the data, but it isn’t. So i tried adding it as a new step but the result is the same, no values are added.
What appears to be happening is because the “weekNum” and “yearNum” values from my table are separate from the main table, Bubble treats them as a new row of data, rather than letting me reference the value they contain directly.
In the screenshot of my databse above, you can see that the weekNum (19) and the yearNum (2024) values are split over different rows, instead of being added to the rows of existing data as intended.
If I prevent Bubble adding a new row for weekNum and yearNum (by adding a Only when) the result is no Week or Year values at all.
I hope this is helpful?