Displaying data from two different CDT's in a single grid

I am working on a questionnaire application in which a question can be set as a parent and it can have multiple child questions.

I have created two different tables, one to hold parent questions and the other one to hold child questions. Also, I have created two different CDT's for the same in Appian.

In interface, I am displaying all the questions in a grid layout using foreach. If a question has child questions, I want to display those child questions right below the parent question as part of the same grid layout but currently I am unable to do so since parent and child questions are of two different CDT's.

Is there a way I can list both parent and child questions in the same grid?

Thank you in Advance.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi Ram, have you configured foreign key between these two tables? If yes then query your child table in a local variable. And when you are showing parent table questions ,there you can filter out child questions based on parent id from child table output data.

  • Hi Gopal,

    Thank you for your answer.

    Yes, I have configured foreign key relationship between the tables.

    Currently, I am fetching parent questions from table to a local variable and child questions to a different local variable.

    I am displaying all parent questions using foreach in a grid layout and currently it gets displayed as below. Since both child and parent questions are of two different CDT's, I am unable to combine them both in a single foreach and display it in a single grid layout.

    S.No | Question
    1.      |  Parent Question 1
    2.      |  Parent Question 2

    Let's say for example, Question 1 has two child questions, I want it to be displayed as below

    S.No | Question
    1.      | Parent Questions 1
    1.1    | Child Question1 of Parent 1
    1.2    | Child Question 2 of Parent 1
    2.      | Parent Question 2

    Please let me know if this can be achieved.

Reply
  • Hi Gopal,

    Thank you for your answer.

    Yes, I have configured foreign key relationship between the tables.

    Currently, I am fetching parent questions from table to a local variable and child questions to a different local variable.

    I am displaying all parent questions using foreach in a grid layout and currently it gets displayed as below. Since both child and parent questions are of two different CDT's, I am unable to combine them both in a single foreach and display it in a single grid layout.

    S.No | Question
    1.      |  Parent Question 1
    2.      |  Parent Question 2

    Let's say for example, Question 1 has two child questions, I want it to be displayed as below

    S.No | Question
    1.      | Parent Questions 1
    1.1    | Child Question1 of Parent 1
    1.2    | Child Question 2 of Parent 1
    2.      | Parent Question 2

    Please let me know if this can be achieved.

Children