-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to map a List<Object> and loop through it while writing #96
Comments
It depends. Is there a fixed, maximum number of children? If so, I would recommend a separate column for each possible child, leaving them blank if not applicable. You can specify "complex" columns, so you can have a column that is a fixed record itself. |
Thanks for your prompt answer. The list of child is coming from a database, so I don't know in advance the exact number.
What do you recommend? Thanks |
It's hard to have a fixed width file when the number of columns is not known ahead of time. If they are literal children, you could probably get away with 25 being your fixed count, since only a few people in history have had that many kids, even with remarrying. 😆 Alternatively suggest multiple files. |
Thanks. For my scenario, multiple files is not allowed. I will see if that can be approved.
and then after the loop, write all the records at once with |
I have to generate a fixed-length text file. How can I map a list of object in my main model? Let's assume that I have the following models:
Thanks
The text was updated successfully, but these errors were encountered: