movie ticket booking Seating Arrangement dynamically

Certified Senior Developer

How to create a movie ticket booking Seating Arrangement dynamically based on individual theater the seating for each and every theater is different. Admin can change the no.of seats how much he required.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to venkat Avuluri

    Hi,

    Yes I've gone through the code, they passed the no. of seats as statically(say 6 in every row in the above code),Now I need to pass the no. of seats dynamically based on the theater.

    Thanks

  • 0
    Certified Senior Developer
    in reply to Shravani

    a!localVariables(
      local!columns: 10,
      /*Pass it dynamically   */
      local!rows: 10,
      local!theaterSeating: 
        a!forEach(
          items: enumerate(local!rows) + 1,
          expression: a!localVariables(
            local!rowNumber: fv!index,
            a!forEach(
              items: enumerate(local!columns) + 1,
              expression: a!map(
                rownumber: local!rowNumber,
                columnnumber: fv!item,
                selected: false
              )
            )
          )
        )
      ,
      local!Seats:
      a!refreshVariable(
        value: a!flatten(local!theaterSeating),
        refreshOnVarChange: {local!theaterSeating}
      ),
      local!selectedSeats:a!refreshVariable(
     value:  index(local!Seats,wherecontains(true,toboolean(local!Seats.selected)),null),
     refreshOnVarChange: {local!Seats,local!theaterSeating}
      ),
      
      {
        a!cardLayout(
          contents: {
            a!forEach(
              items: local!theaterSeating,
              expression: a!sideBySideLayout(
                items: 
              a!forEach(
                items: fv!item,
                expression: a!sideBySideItem(
                  item: a!richTextDisplayField(
                    value:a!richTextIcon(
                      icon: if(fv!item.selected,"square-full",
                        "square-o"),
                        link: a!dynamicLink(
                          saveInto: {a!save(fv!item.selected,if(fv!item.selected=true,false,
                          true))
                          }
                        )
                    )
                  )
                )
              ))
            )
          }
        )
      }
    )

    Take a look at this code Shravani , I don't prefer it because if the rows are columns are too high, data on the interface ( in map) gonna be large so leads to performance issues (interface might gets slow), So go for alternatives. Or if you find any alternative within appian let us know

  • 0
    Certified Senior Developer
    in reply to Shravani

    If the answer has helped you please verify the answers that were helpful and mark the thread as closed Shravani.