We receive an XML document where I unpacked the records and flattened the arrays so we can write to a Microsoft Excel file. Each record should have an identifier but the XML document only has this identifier at the end of each group. I was able to get the identifier added to the last record of the group. Now, I need to add this identifier to each record above the previous record based on the number of records in that group. I do have the number of records that should be in each group which comes from the XML document.
In the below example, account ab has identifier as 105 and is the only record in that group. For account ff having the identifier of 106, this identifier should be applied to account ds and account ff. For account asdf having an identifier of 556, this identifier should be applied to accounts ss through asdf and so on.
Does anybody have any suggestions on how I can add the identifers to previous records based on the number of records for each group?