Scaling an operation to n-times

Here’s a problem I knew I was going to run into someday, and that someday is today.

There’s a linking mechanism between supplier bills and payments made against them, as the bills are often paid in part.

When a bill is paid by two separate payments then the ‘First payment particulars’ column and ‘second payment particulars’ column are filled up with the transaction details. That required me to keep the two columns within the database.

Now I tried to keep the bill payments such that the full amount is paid in not more than two transactions, but now a situation has come up in which a bill amount has been paid in four separate payments. Now if I kept columns such as ‘first’, ‘second’, ‘third’, ‘fourth’ payment particulars then the four columns would have to theoretically get filled with the details of the four transactions, not to mention the mechanism of choosing the bills (full payment, part payment etc) would also have to be changed significantly. But without diving much into the mechanics of the operation right now, I want to know first that is there a way to scale things like this to any number of times that is desired?

That would require automatic adding of payment columns in the background.

Is it a feature that is possible?

Re: I dug around a bit and recalled one of an old conversation between me and @WillowMobileSystems who urged me to use the parent-child approach in the beginning. I was so in on making it work in the way that it is now, I ignored the suggestion.

But now I think that’s the way to deal with situations where there is a need to scale things column-wise rather than row-wise. Because software are inherently designed to add rows automatically, not columns.

Yes, this should be done row based. There is not a method to make this column based.
You would likely just have a deck view of Bills and then a button to linktoform() and just fill the parent id from this.