Movie ticket seating arrangement

Certified Senior Developer

I am having a scenario to select the seat in a theater. Once I click on the seat the particular seat is selecting again I want to de-select the seat it is not getting null from the selected seats. We have used remove function to de-select the seat and we have tried to null the particular index but it is not getting null

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hello  

    Please share your code, that would help us understand how you are trying to perform your logic.

  • 0
    Certified Senior Developer
    in reply to Konduru Chaitanya

    a!localVariables(
    local!selectedSeat,
    local!totalSelectedRow1: { 0 },
    local!totalSelectedRow2: { 0 },
    local!totalSelectedRow3: { 0 },
    local!totalSelectedRow4: { 0 },
    local!totalSelectedRow5: { 0 },
    {
    a!sectionLayout(
    contents: {
    a!columnsLayout(
    columns: a!forEach(
    items: enumerate(6)+1 ,
    expression: {
    a!columnLayout(
    contents: {
    a!richTextDisplayField(
    value: {
    a!richTextIcon(
    color: if(
    contains(local!totalSelectedRow1, fv!item),
    "SECONDARY",
    "ACCENT"
    ),
    icon: "square-o",
    size: "MEDIUM_PLUS",
    link: a!dynamicLink(
    value: fv!item,
    saveInto: {
    a!save(local!selectedSeat, save!value),
    if(
    contains(
    local!totalSelectedRow1,
    local!selectedSeat
    ),
    a!save(
    local!totalSelectedRow1,
    remove(
    local!totalSelectedRow1,
    local!selectedSeat
    )
    ),
    a!save(
    local!totalSelectedRow1,
    append(
    local!totalSelectedRow1,
    local!selectedSeat
    )
    )
    )
    }
    )
    )
    }
    ),

    }
    )
    }
    )
    ),
    a!columnsLayout(
    columns: a!forEach(
    items: enumerate(6) + 1,
    expression: {
    a!columnLayout(
    contents: {
    a!richTextDisplayField(
    value: {
    a!richTextIcon(
    color: if(
    contains(local!totalSelectedRow2, fv!item),
    "SECONDARY",
    "ACCENT"
    ),
    icon: "square-o",
    size: "MEDIUM_PLUS",
    link: a!dynamicLink(
    value: fv!item,
    saveInto: {
    a!save(local!selectedSeat, save!value),
    a!save(
    local!totalSelectedRow2,
    append(
    local!totalSelectedRow2,
    local!selectedSeat
    )
    )
    }
    )
    )
    }
    ),

    }
    )
    }
    )
    ),
    a!columnsLayout(
    columns: a!forEach(
    items: enumerate(6) + 1,
    expression: {
    a!columnLayout(
    contents: {
    a!richTextDisplayField(
    value: {
    a!richTextIcon(
    color: if(
    contains(local!totalSelectedRow3, fv!item),
    "SECONDARY",
    "ACCENT"
    ),
    icon: "square-o",
    size: "MEDIUM_PLUS",
    link: a!dynamicLink(
    value: fv!item,
    saveInto: {
    a!save(local!selectedSeat, save!value),
    a!save(
    local!totalSelectedRow3,
    append(
    local!totalSelectedRow3,
    local!selectedSeat
    )
    )
    }
    )
    )
    }
    ),

    }
    )
    }
    )
    ),
    a!columnsLayout(
    columns: a!forEach(
    items: enumerate(6) + 1,
    expression: {
    a!columnLayout(
    contents: {
    a!richTextDisplayField(
    value: {
    a!richTextIcon(
    color: if(
    contains(local!totalSelectedRow4, fv!item),
    "SECONDARY",
    "ACCENT"
    ),
    icon: "square-o",
    size: "MEDIUM_PLUS",
    link: a!dynamicLink(
    value: fv!item,
    saveInto: {
    a!save(local!selectedSeat, save!value),
    a!save(
    local!totalSelectedRow4,
    append(
    local!totalSelectedRow4,
    local!selectedSeat
    )
    )
    }
    )
    )
    }
    ),

    }
    )
    }
    )
    ),
    a!columnsLayout(
    columns: a!forEach(
    items: enumerate(6) + 1,
    expression: {
    a!columnLayout(
    contents: {
    a!richTextDisplayField(
    value: {
    a!richTextIcon(
    color: if(
    contains(local!totalSelectedRow5, fv!item),
    "SECONDARY",
    "ACCENT"
    ),
    icon: "square-o",
    size: "MEDIUM_PLUS",
    link: a!dynamicLink(
    value: fv!item,
    saveInto: {
    a!save(local!selectedSeat, save!value),
    a!save(
    local!totalSelectedRow5,
    append(
    local!totalSelectedRow5,
    local!selectedSeat
    )
    )
    }
    )
    )
    }
    ),

    }
    )
    }
    )
    ),

    }
    )
    }
    )

  • 0
    Certified Senior Developer
    in reply to Srihari Karimireddy

    Hi   It's an Old post , I am guessing you got the answer , If not i did few changes to your code just take a look

    a!localVariables(
      local!selectedSeat,
      local!totalSelectedRow1: { 0 },
      local!totalSelectedRow2: { 0 },
      local!totalSelectedRow3: { 0 },
      local!totalSelectedRow4: { 0 },
      local!totalSelectedRow5: { 0 },
      {
        a!sectionLayout(
          contents: {
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow1, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow1,
                                  if(
                                    contains(local!totalSelectedRow1, fv!item),
                                    remove(
                                      local!totalSelectedRow1,
                                      wherecontains(fv!item, local!totalSelectedRow1)
                                    ),
                                    append(local!totalSelectedRow1, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow2, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                               saveInto: {
                                a!save(
                                  local!totalSelectedRow2,
                                  if(
                                    contains(local!totalSelectedRow2, fv!item),
                                    remove(
                                      local!totalSelectedRow2,
                                      wherecontains(fv!item, local!totalSelectedRow2)
                                    ),
                                    append(local!totalSelectedRow2, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow3, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow3,
                                  if(
                                    contains(local!totalSelectedRow3, fv!item),
                                    remove(
                                      local!totalSelectedRow3,
                                      wherecontains(fv!item, local!totalSelectedRow3)
                                    ),
                                    append(local!totalSelectedRow3, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow4, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow4,
                                  if(
                                    contains(local!totalSelectedRow4, fv!item),
                                    remove(
                                      local!totalSelectedRow4,
                                      wherecontains(fv!item, local!totalSelectedRow4)
                                    ),
                                    append(local!totalSelectedRow4, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow5, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow5,
                                  if(
                                    contains(local!totalSelectedRow5, fv!item),
                                    remove(
                                      local!totalSelectedRow5,
                                      wherecontains(fv!item, local!totalSelectedRow5)
                                    ),
                                    append(local!totalSelectedRow5, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            
          }
        )
      }
    )

    And take a look into this thread  https://community.appian.com/discussions/f/user-interface/33990/movie-ticket-booking-seating-arrangement-dynamically/129172  , Bit dynamic

Reply
  • 0
    Certified Senior Developer
    in reply to Srihari Karimireddy

    Hi   It's an Old post , I am guessing you got the answer , If not i did few changes to your code just take a look

    a!localVariables(
      local!selectedSeat,
      local!totalSelectedRow1: { 0 },
      local!totalSelectedRow2: { 0 },
      local!totalSelectedRow3: { 0 },
      local!totalSelectedRow4: { 0 },
      local!totalSelectedRow5: { 0 },
      {
        a!sectionLayout(
          contents: {
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow1, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow1,
                                  if(
                                    contains(local!totalSelectedRow1, fv!item),
                                    remove(
                                      local!totalSelectedRow1,
                                      wherecontains(fv!item, local!totalSelectedRow1)
                                    ),
                                    append(local!totalSelectedRow1, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow2, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                               saveInto: {
                                a!save(
                                  local!totalSelectedRow2,
                                  if(
                                    contains(local!totalSelectedRow2, fv!item),
                                    remove(
                                      local!totalSelectedRow2,
                                      wherecontains(fv!item, local!totalSelectedRow2)
                                    ),
                                    append(local!totalSelectedRow2, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow3, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow3,
                                  if(
                                    contains(local!totalSelectedRow3, fv!item),
                                    remove(
                                      local!totalSelectedRow3,
                                      wherecontains(fv!item, local!totalSelectedRow3)
                                    ),
                                    append(local!totalSelectedRow3, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow4, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow4,
                                  if(
                                    contains(local!totalSelectedRow4, fv!item),
                                    remove(
                                      local!totalSelectedRow4,
                                      wherecontains(fv!item, local!totalSelectedRow4)
                                    ),
                                    append(local!totalSelectedRow4, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            a!columnsLayout(
              columns: a!forEach(
                items: enumerate(6) + 1,
                expression: {
                  a!columnLayout(
                    contents: {
                      a!richTextDisplayField(
                        value: {
                          a!richTextIcon(
                            color: if(
                              contains(local!totalSelectedRow5, fv!item),
                              "SECONDARY",
                              "ACCENT"
                            ),
                            icon: "square-o",
                            size: "MEDIUM_PLUS",
                            link: a!dynamicLink(
                              value: fv!item,
                              saveInto: {
                                a!save(
                                  local!totalSelectedRow5,
                                  if(
                                    contains(local!totalSelectedRow5, fv!item),
                                    remove(
                                      local!totalSelectedRow5,
                                      wherecontains(fv!item, local!totalSelectedRow5)
                                    ),
                                    append(local!totalSelectedRow5, fv!item)
                                  )
                                )
                              }
                            )
                          )
                        }
                      ),
                      
                    }
                  )
                }
              )
            ),
            
          }
        )
      }
    )

    And take a look into this thread  https://community.appian.com/discussions/f/user-interface/33990/movie-ticket-booking-seating-arrangement-dynamically/129172  , Bit dynamic

Children
No Data