I have a page of records that contains 3 records. 1 order has ORDERNO 000020. Another 2 orders has the same ORDERNO 000021, but has different ordered goods.
In a "preSavePage" hook, I basically changed the data to so that it removes the duplicated ORDERNO and combines them into one with its different goods.
Then these records goes into the API call and succeeded. And only when API call succeeded, I want to generate a json file in FTP for these two records to acknowledge that these two orders has been placed.
Somehow, whenever I run the flow, it is only generating 1 file. I have "skip aggregation" set to true, and one to many set to yes... also tried setting one to many as no... none of them seem to work.
@tinoliu you should remove the preSavePage script, add a grouping for ORDERNO in the FTP export under the grouping and sorting section, set the page size on the export to 1, then set skip aggregation to true on the import.
The reason I did it with preSavePage is because I used it to put a property "goodsDtoList" that basically does the "each" in the handlebars template. And in my build URI template... all i had to do is write "goodsDtoList": ' jsonSerialize data.0.goodsDtoList '
After adding grouping by ORDERNO, I still created a preSavePage hook and lopped through "data" and created an array of objects within the first index object inside "data". (Not exactly elegant, but it's a working hack).
@tinoliu glad you figured it out! Whenever I group records, I typically restructure it so it's easier to follow. For example, when you group by ORDERNO, you end up with a rows array where ORDERNO repeats for each row, but I typically like to convert the rows array into a single record object with a lines array. For example, the below screenshot uses a transformation on thee export to convert the rows to a record. You could do this in your preSavePage script as well.