When the value of "operator" is "=" "value" must not be null or empty.

It report error with this which have been hinder me for couple days.

Interface Definition: Expression evaluation error at function a!queryLogicalExpression [line 25]: The a!queryFilter function has an invalid value for the "value" parameter. When the value of "operator" is "=" "value" must not be null or empty.

a!localVariables(
a!formLayout(
  label: "Username",
  contents: {
    a!textField(
      label: "username",
      labelPosition: if(
        ri!readOnly,
        "ADJACENT",
        "ABOVE"
      ),
      value: ri!username.username,
      saveInto: ri!username.username,
      refreshAfter: "UNFOCUS",
      validations: {
        if(
          a!queryEntity(
            entity: cons!usernameConstant,
            query: a!query(
              fetchTotalCount: true,
              pagingInfo: a!pagingInfo(
                startIndex: 1,
                batchSize: 1
              ),
              logicalexpression: a!queryLogicalExpression(
                operator:"OR",
              filters: {
              a!queryFilter(
                field: "username",
                operator: "=",
                value:(ri!username.username)
              ),
              a!queryFilter(
                field: "username",
                operator: "is null"
              ),
              }
              )
            )
          ).totalCount > 0,
          "Username exists",
          null
        )

      }
    ),
    a!textField(
      label: "gender",
      labelPosition: if(
        ri!readOnly,
        "ADJACENT",
        "ABOVE"
      ),
      value: ri!username.gender,
      saveInto: ri!username.gender,
      refreshAfter: "UNFOCUS",
    ),
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!textField(
              label: "Password",
              labelPosition: if(
                ri!readOnly,
                "ADJACENT",
                "ABOVE"
              ),
              value: ri!username.password,
              saveInto: ri!username.password,
              characterLimit: 255,
              readOnly: ri!readOnly
            )
          }
        )
      }
    ),
  },
 
  buttons: a!buttonLayout(
    primaryButtons: {
      a!buttonWidget(
        label: "Insert",
        
        saveInto:(
          a!writeToDataStoreEntity(
            dataStoreEntity: cons!usernameConstant,
            valueToStore:(ri!username)
           ),       
           ),
           
        submit: true,
        style: "PRIMARY",
      ),
      a!buttonWidget(
        label: "update",
        saveInto:(
          a!writeToDataStoreEntity(
            dataStoreEntity: cons!usernameConstant,
            valueToStore:ri!username,           
          ),
        ),
        submit: true,
        style: "PRIMARY"
      ),
      a!buttonWidget(
        label: "delete",      
        saveInto:(
          a!deleteFromDataStoreEntities(
            dataToDelete: {
              a!entityDataIdentifiers(
                entity: cons!usernameConstant,
                identifiers:{ri!username.username},
              )
            }
          )
        ),
        submit: true,
        style: "PRIMARY"
      )
    },
    secondaryButtons: {
      a!buttonWidget(
        label: "Cancel",
        value: true,
        saveInto: ri!cancel,
        submit: true,
        style: "NORMAL",
        validate: false
      )
    },
    showWhen: or(
      isnull(
        ri!readOnly
      ),
      not(
        ri!readOnly
      )
    )
  )
 
)
)

  Discussion posts and replies are publicly visible

Parents
  • Hello Immortalvirgil,

    Try giving test values for username field which would resolve your error.

    I believe username is a unique value over here and you are trying to check whether username exists or not. 

    If you want to get data for a single username which you provide it  is not required to check for is null and as mentioned by , use applywhen attribute if you don't want to apply the filter in case value not given for the specified field which would not apply filter but in this case you would get all the data apart from filtering.

    Try to check null condition if you are trying to check a single username. Hope this would help.

Reply
  • Hello Immortalvirgil,

    Try giving test values for username field which would resolve your error.

    I believe username is a unique value over here and you are trying to check whether username exists or not. 

    If you want to get data for a single username which you provide it  is not required to check for is null and as mentioned by , use applywhen attribute if you don't want to apply the filter in case value not given for the specified field which would not apply filter but in this case you would get all the data apart from filtering.

    Try to check null condition if you are trying to check a single username. Hope this would help.

Children
No Data