I’m working on creating a relationship between words and letters tables.
In the attached example, I attempted to break down the word “BABY” into its individual letters (B, A, B, Y) and establish a relationship with the corresponding letters in order.
However, I’m facing two issues:
The related items are being sorted alphabetically, which is not intended.
The letter B only appears once instead of twice.
Is there a way to resolve these two issues? Perhaps approaching it differently might help?
That’s not quite how relations work. Relations look for matching rows in the table you are relating to. If the table only has one match then it’s only going to return one result, no matter how many duplicated items in your array have a match. You can’t turn one row into two if the second one doesn’t physically exist.
As for sorting, you can adjust sorting if you use a query column instead of a relation or sort the collection, but you really won’t get what you want if the sort order doesn’t match numeric, alphabetic, or table order.
Might need an explanation of your goal to see if there is a different and better way to approach it. I’m guessing it would involve a helper table and transposing each letter into a row in the helper table. Then you could probably achieve what you want since it would allow for duplicate letters and you would have control over row order.