Skip to main content
January 15, 2023
Question

Getting error

  • January 15, 2023
  • 4 replies
  • 0 views

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"

    4 replies

    rajeshk0007
    New Participant
    January 15, 2023

    Hello [mention:ba8c059c18d44cea97154520c1c14b29:e9ed411860ed4f2ba0265705b8793d05]  you're missing the comma for your value attribute after the if condition statement  and before the save into attribute, Hope this is helpful.

    January 15, 2023

    Hi Kilaru,

    Thanks for your response, I am still facing some difficulties with my code. 

    Here I am attaching my full code please guide me how to resolve it.

    The error I am getting is "Expression evaluation error: Syntax error. Details: Expression evaluation error at function a!columnLayout parameter 1: A function expression contains duplicate keywords. Keyword: value."

    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,
    value: local!seattype,
    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
    )
    }
    )
    )
    )

    January 15, 2023

    Hi Amritesh, it looks like you have a duplicate 'value' attribute in your last a!dropdownField. You are also missing a comma after the 'value' attribute in your Total Amounts a!textField. Hope that helps 

    Inspiring
    January 16, 2023

    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
            )
          }
        )
      )
    )