Getting error

Hi Community,

I am getting error while using decision to get total amount. 

Error says "Expression evaluation error: Syntax error. Details: Expression evaluation error at function a!textField parameter 4 [line 90]: Missing right parenthesis in expression, found COMMA"

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    You used 'value' attribute two times in one of the dropdown. Also there were comma missing at many places. Here is the code after correcting the syntax errors.

    a!localVariables(
      local!seattype,
      a!formLayout(
        label: "Ticket Booking Form",
        contents: {
          a!sectionLayout(
            label: "Section",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Name",
                        labelPosition: "ABOVE",
                        value: ri!Name,
                        saveInto: { ri!Name },
                        refreshAfter: "UNFOCUS",
                        validations: {}
                      ),
                      a!integerField(
                        label: "Age",
                        labelPosition: "ABOVE",
                        value: ri!Age,
                        saveInto: { ri!Age },
                        refreshAfter: "UNFOCUS",
                        validations: { if(ri!Age > 100, "Enter valid Age", {}) }
                      ),
                      a!dropdownField(
                        label: "Gender",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { "Male", "Female", "others" },
                        choiceValues: { 1, 2, 3 },
                        value: ri!Gender,
                        saveInto: { ri!Gender },
                        searchDisplay: "AUTO",
                        validations: {}
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      a!dropdownField(
                        label: "Movie Name",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { cons!TBS3_MOVIE_NAME },
                        choiceValues: { cons!TBS3_MOVIE_NAME },
                        value: ri!Movie_name,
                        saveInto: { ri!Movie_name },
                        searchDisplay: "AUTO",
                        validations: {}
                      ),
                      a!dropdownField(
                        label: "Seat Type",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { "Silver", "Gold", "Platinum", "Recliner" },
                        choiceValues: { "Silver", "Gold", "Platinum", "Recliner" },
                        value: ri!Seat_type,
                        saveInto: { ri!Seat_type },
                        searchDisplay: "AUTO",
                        validations: {}
                      ),
                      a!integerField(
                        label: "Number of seat",
                        labelPosition: "ABOVE",
                        value: ri!number_of_seat,
                        saveInto: { ri!number_of_seat },
                        refreshAfter: "UNFOCUS",
                        validations: {
                          if(
                            ri!number_of_seat > 10,
                            "Enter Valid number of seats",
                            {}
                          )
                        }
                      )
                    }
                  )
                }
              )
            }
          ),
          a!textField(
            label: "Total Amount",
            labelPosition: "ABOVE",
            value: if(
              and(
                a!isNotNullOrEmpty(ri!Seat_type),
                a!isNotNullOrEmpty(ri!number_of_seat)
              ),
              dollar(
                rule!TBS3_ValueSeatType(seatType: ri!Seat_type) * ri!number_of_seat,
                2
              ),
              {}
            ),
            saveInto: { ri!Total_amount },
            refreshAfter: "UNFOCUS",
            validations: {}
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true,
              saveInto: {
                a!save(
                  target: ri!Created_By,
                  value(loggedInUser())
                ),
                a!save(target: ri!Created_on, value(now())),
    
              },
              style: "PRIMARY"
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: ri!cancel,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      )
    )

Reply
  • 0
    Certified Associate Developer

    You used 'value' attribute two times in one of the dropdown. Also there were comma missing at many places. Here is the code after correcting the syntax errors.

    a!localVariables(
      local!seattype,
      a!formLayout(
        label: "Ticket Booking Form",
        contents: {
          a!sectionLayout(
            label: "Section",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Name",
                        labelPosition: "ABOVE",
                        value: ri!Name,
                        saveInto: { ri!Name },
                        refreshAfter: "UNFOCUS",
                        validations: {}
                      ),
                      a!integerField(
                        label: "Age",
                        labelPosition: "ABOVE",
                        value: ri!Age,
                        saveInto: { ri!Age },
                        refreshAfter: "UNFOCUS",
                        validations: { if(ri!Age > 100, "Enter valid Age", {}) }
                      ),
                      a!dropdownField(
                        label: "Gender",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { "Male", "Female", "others" },
                        choiceValues: { 1, 2, 3 },
                        value: ri!Gender,
                        saveInto: { ri!Gender },
                        searchDisplay: "AUTO",
                        validations: {}
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      a!dropdownField(
                        label: "Movie Name",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { cons!TBS3_MOVIE_NAME },
                        choiceValues: { cons!TBS3_MOVIE_NAME },
                        value: ri!Movie_name,
                        saveInto: { ri!Movie_name },
                        searchDisplay: "AUTO",
                        validations: {}
                      ),
                      a!dropdownField(
                        label: "Seat Type",
                        labelPosition: "ABOVE",
                        placeholder: "--- Select a Value ---",
                        choiceLabels: { "Silver", "Gold", "Platinum", "Recliner" },
                        choiceValues: { "Silver", "Gold", "Platinum", "Recliner" },
                        value: ri!Seat_type,
                        saveInto: { ri!Seat_type },
                        searchDisplay: "AUTO",
                        validations: {}
                      ),
                      a!integerField(
                        label: "Number of seat",
                        labelPosition: "ABOVE",
                        value: ri!number_of_seat,
                        saveInto: { ri!number_of_seat },
                        refreshAfter: "UNFOCUS",
                        validations: {
                          if(
                            ri!number_of_seat > 10,
                            "Enter Valid number of seats",
                            {}
                          )
                        }
                      )
                    }
                  )
                }
              )
            }
          ),
          a!textField(
            label: "Total Amount",
            labelPosition: "ABOVE",
            value: if(
              and(
                a!isNotNullOrEmpty(ri!Seat_type),
                a!isNotNullOrEmpty(ri!number_of_seat)
              ),
              dollar(
                rule!TBS3_ValueSeatType(seatType: ri!Seat_type) * ri!number_of_seat,
                2
              ),
              {}
            ),
            saveInto: { ri!Total_amount },
            refreshAfter: "UNFOCUS",
            validations: {}
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true,
              saveInto: {
                a!save(
                  target: ri!Created_By,
                  value(loggedInUser())
                ),
                a!save(target: ri!Created_on, value(now())),
    
              },
              style: "PRIMARY"
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: ri!cancel,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      )
    )

Children
No Data