Closed Snoogms closed 5 years ago
If anyone else is experiencing this I'm currently solving this by using the Mutiline addon for VS.
And, also, thank you so much for this sheets addon, love it!
Glad to see people getting use out of the Nested Element functionality in ESD! One of ESD's current shortcomings is that Nested Elements doesn't handle empty cells very well. You can set your export to ignore empty cells to prevent empty object values from being exported, but that will also exclude the affected field (for that specific row) from the export.
It is set to ignore empty cells. I tried removing the checkmark, export, replace the checkmark, export. Each instance produces these mysetious brackets. Besides, there's plenty of empty cells where this does not happen. Hence the title, "mysterious brackets" :)
I might also add, that I've exported the same sheets multiple times in the past without this bug appearing.
Ah, I didn't realize it was only a few specific empty fields. Does any other data seem affected? Also, would you be able to provide an example sheet and the settings used so I can try to replicate the issue?
I can share this document with you with viewing privleges if that helps?
That will help. With the sheet, I can try to reproduce the issue on my end and debug the export process. If you have data that you can't or don't want to share, you can change the values around and send a duplicate instead, if desired.
Send me the email you want me to share it to: arelius.areliusarson@gmail.com
My settings:
Any updates on this, still haven't received an email from you yet ...
Sorry about that, my schedule has been crazy for the past two weekends and the work week. Just sent an email to you regarding this.
I've found the issue. Those empty objects are added because the affected section has hard set index values when searching through the "materials" array. The values in the last column are looking for the fourth array element, causing the export process to add empty elements until reaching the desired element index.
Moving those values over to the left will fix the issue.
Hi Synthoid, thank you so much for your time and effort figuring this out!
I'm afraid I don't quite understand the solution though. Can you be more specific?
Do you mean that the values in column HT (in Recipes#5) are looking for the Recipes#4 columns?
Also, is this behaviour something you intend to keep, and if so, what do I need to keep in mind for this not to happen again?
Your key formatting was correct, but the way Nested Elements search through arrays caused the empty objects to be added to your output data. Specifically, [materials]{#4}id
looks for the fourth element of the materials array to set the id
field value for. If that array has less than 4 elements, empty elements are added until the target index is reached.
In this case, you were setting the first element's values, skipping the second and third indexes because they were empty cells, then setting the fourth element's values. Since the array had less than 4 elements, it had to add empty elements to reach the appropriate length so the specified index would be valid.
Moving the 4th indexed values to the left prevents this problem, because they are no longer looking at the 4th index specifically, so no empty objects should be added to the output JSON.
This is one of those fun, tricky parts about Nested Elements that makes them powerful, but also easy to format incorrectly.
I have empty fields that are being translated as: {},
Picture of the sheet: