How to skip next slot based on current slot values in between a form

Hello, as i am working on one some survey bot in that i need to ask reason for the low rated answer given by user.

attaching my code here where if the rating of 1st_qn is below or equal to 3, I need to ask 1st_reason slot otherwise it need to ask 2nd_qn like wise all three questions

forms:
  survey_form:
    required_slots:
      - 1st_qn
      - 1st_reason
      - 2nd_qn
      - 2nd_reason
      - 3rd_qn
      - 3rd_reason

thank you

You could list only the first slot as required and handle the remaining slots as shown in the docs here.

thank you for your response but I need to ask 2nd question and if it is less than a 3 rating again I need to ask the reason for that

That’s fine. I would include only slot 1 in the required_slots for the form. Handle the remaining slots in the required_slots method.

Hi @stephens I have been trying to handle the slots through the required_slots method, but it’s not working correctly. I am not able to loop the slot values to check the rating entered by the user for the next slot value but it is working only one time and in the remaining cases it’s not asking for the subsequent slot.

domain file

forms:
  survey_form:
    required_slots:
      - 1st_qn
      

action.py file

async def required_slots(
        self,
        domain_slots: List[Text],
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
    ) -> List[Text]:
        """A list of required slots that the form has to fill"""
        l = ['3', '2', '1']
        if tracker.get_slot('1st_qn') in l:
            print(tracker.get_slot('1st_qn'))
            return ["1st_qn", "1st_reason","2nd_qn","2nd_reason", "3rd_qn", "3rd_reason"]
        else:
            return ["1st_qn", "2nd_qn", "3rd_qn"]

Thank you