I'm running into a strange issue where an error keeps popping up, and I can't figure out why. It feels like it might be a bug. Here's a simplified version of the XML to show what I mean:
It's the validation for have an each loop specifically for the batch_of_records. As long as your page size is set to 1 and skip aggregation is set to true, then this will work. We're hoping to remove this validation in an upcoming release.
Thanks, this works! I assume that after the release, the current handlebar template setup which is now in place will still function properly following the release update, correct?
For anyone who encounters a similar situation, here are some screenshots to help fix it:
I guess the validation isn’t in place yet, because I’m encountering the issue again.
This time, I set the Business Central export page size to 1 and I set “Skip Aggregation” to true on the FTP transfer, but I’m still getting the same error:
{{# each data}} not found in the template. xml_template_parsing_error
Got it — so always one XML declaration at the top, and then start with {{#each batch_of_records}} (or data), regardless of whether we send one record or multiple.
To summarize for FTP: By default, integrator․io will aggregate all pages of data generated by an export into one (possibly large) file. Check Skip aggregation to instead generate multiple files (one file per page of data).
Important
To generate one file per record, set the export page size to one record per page of data. However, if your page size is set to one record per page and you are using a one to many import, skip aggregation will generate one file per parent record, not one file per child record.
Example if you want to import 1 file:
In the source step, set page size = 1
In the FTP step, enable skip aggregation
XML template: one XML declaration at the top, then the {{#each batch_of_records}} loop inside the body
Example:
If the FTP upload does not include a semicolon (:), it may be caused by the default filename format. When the flow step uses the standard file-{{timestamp}}.xml, update it to a format that explicitly defines the timestamp, for example: file-{{timestamp "YYYY-MM-DDTHHmmss" "Europe/Amsterdam"}}.xml
I got this error when using the semicolon which the FTP did not allow: [Unknown message with code "Invalid path.".][Invalid path.]
If your goal is to make 1 file per record, then yes, you need to set skip aggregation to true and set page size to 1 on the export. If multiple source records can go into 1 file, then you don't need to use skip aggregation and don't need to set your page size to 1.
In any above case, {{#each data}} or {{#each batch_of_records}} is currently required (depending on if you are using AFE 1 or AFE 2).