Let's say I have a list of questions that stores an object that has a list of it's possible answers, and I need to generate all permutation pairs with no duplicates where one element of the pair is in the first list and the second one in the second list. In other words, let's say I have 2 questions, and each one has 2 answers, how many answer sets could I create with this? One last thing, the order is important. An answer from the first question could not be in the position from the 2nd question, if that makes sense.
I hope this is clear.
Edited for clarity
We have an Object called "Question_c". We have another object, "Answer_c". Answer_c has a lookup to Question_c.
In the Question__c object, we have a joiner object that can related a question to another question, so that the "child" question contributes to the answer on the "parent".
We also have one more object that we'll call ContributingQuestionCombos__c. Each record stores one possible combination.
Now, taking the Answers from the contributing questions, and the answers from the parent question, I am trying to make a CSV template that has all of the possible answer combinations for the options provided. There can be up to 4 "contributing" questions. Should the number of possible combinations be above 200, then I do not include the combinations in the CSV template. The columns in the CSV template are ControllingQuestionId_c, Answer1_c, Answer2_c, Answer3_c, Answer4__c.
Let's say we have 4 contributing questions, the answers from Question 1 can only ever be in the Answer1_c column, Question 2 can only be in Answer2_c, etc and so forth.
Given that logic, what I'm trying to do is prepopulate this CSV Template with the combinations for the user and provided there aren't too many.
So in all there would be 9 combinations total for 2 questions with 2 answers each as we are including blank answers as a potential combination.
Here's an example
I hope that clarifies things a bit!
Thanks for taking the time to help, I really appreciate it :)