Displaying Data

Hi all,

I have a requirement like, there are 2 user input task , 1st interface has a paragraph field to ask question, then it will go to second interface which is also a paragraph field, where label is the question asked in 1st interface

and the value entered in 2nd interface is answer.

Again the form will come back to 1st form,which should display both question,answer in a paging grid.

can you please help me,how can I achive this scenario.

Thanks,

Divya

  Discussion posts and replies are publicly visible

Parents
  • Hi Divya

    First, you do not need to use the pattern you are suggesting. Yes, it would work, but because SAIL is dynamic you can do all this in a single SAIL interface. I'm including the following example not as the answer (because you may have other requirements that I am not aware of), but to help you understand what is possible:

    load(
      local!question,
      local!answer,
      local!listOfQandA: {
      },
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents:   {
              a!textField(
                label: "Question",
                value: local!question,
                saveInto: {
                  local!question
                }
              ),
              a!paragraphField(
                showWhen: fn!not(fn!isnull(local!question)),
                label: "Answer",
                value: local!answer,
                saveInto: {
                  local!answer
                }
              ),
              a!buttonArrayLayout(
                showWhen: fn!and(
                  fn!not(fn!isnull(local!question)),
                  fn!not(fn!isnull(local!answer))
                  ),
                buttons: {
                  a!buttonWidget(
                    label: "Add to list",
                    saveInto: {
                      a!save(
                        local!listOfQandA,
                        fn!append(
                          local!listOfQandA,
                          {question: local!question, answer: local!answer}
                        )
                      ),
                      a!save(
                        {local!answer,local!question},
                        null
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!gridField(
                label: "Questions & Answers",
                columns: {
                  a!gridColumn(
                    label: "Question",
                    value: fn!index(fv!row,"question",null)
                  ),
                  a!gridColumn(
                    label: "Answer",
                    value: fn!index(fv!row,"answer",null)
                  )
                },
                data: local!listOfQandA
              )
            }
          )
        }
      )
    )

Reply
  • Hi Divya

    First, you do not need to use the pattern you are suggesting. Yes, it would work, but because SAIL is dynamic you can do all this in a single SAIL interface. I'm including the following example not as the answer (because you may have other requirements that I am not aware of), but to help you understand what is possible:

    load(
      local!question,
      local!answer,
      local!listOfQandA: {
      },
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents:   {
              a!textField(
                label: "Question",
                value: local!question,
                saveInto: {
                  local!question
                }
              ),
              a!paragraphField(
                showWhen: fn!not(fn!isnull(local!question)),
                label: "Answer",
                value: local!answer,
                saveInto: {
                  local!answer
                }
              ),
              a!buttonArrayLayout(
                showWhen: fn!and(
                  fn!not(fn!isnull(local!question)),
                  fn!not(fn!isnull(local!answer))
                  ),
                buttons: {
                  a!buttonWidget(
                    label: "Add to list",
                    saveInto: {
                      a!save(
                        local!listOfQandA,
                        fn!append(
                          local!listOfQandA,
                          {question: local!question, answer: local!answer}
                        )
                      ),
                      a!save(
                        {local!answer,local!question},
                        null
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!gridField(
                label: "Questions & Answers",
                columns: {
                  a!gridColumn(
                    label: "Question",
                    value: fn!index(fv!row,"question",null)
                  ),
                  a!gridColumn(
                    label: "Answer",
                    value: fn!index(fv!row,"answer",null)
                  )
                },
                data: local!listOfQandA
              )
            }
          )
        }
      )
    )

Children
No Data