Bar chart user filter validation

Hi there !

So... I've created a bar chart with some custom fields filters. Now, I'm trying to create a validation for 2 date fields, since they're about date interval and I wanna validate if the second one isn't greater than first one, for example.

I created some validations on field, using "validations" property. It shows error mesage, but still filter chart's data.

Here is the point: I wanna prevent it. Doing a analogy to web development, I wanna prevent the load event.

Is it possible ?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    HI Bruno, If you are querying data based on filters then add the date validation condition  while querying the data as well. i suppose you are querying data in a local variable , if so then add a conditon in the filter parameter based on date validation. below is an basic example ,

    a!localVariables(
      local!data:a!queryEntity(
        entity: cons!entity_emp,
        query: a!query(
          pagingInfo: a!pagingInfo(startIndex: 1,batchSize: -1),
          filter: a!queryFilter(
            field: "id",
            operator: "=",
            value: ri!id,
            applywhen: local!startDate<local!endDate
          )
        )
      )
    )

  • Ty 4 reply !

    Sorry, maybe I wasn't so clear: I wanna validate the inputs, instead the result. If user's input not satisfy my condition, report shouldn't to refresh. Pretty much like Javacript validation, preventing a post.

  • Hi Bruno,

    Given what you're looking for I would do an if() statement within the saveInto. Something like the below. You can also have an validation parameter that shows up as expected when this happens so the user knows, you'd just have to validate based on the tempDate variable.

    saveInto: {
    local!tempDate,
        if(
            local!tempDate>local!dateTwo,
            a!save(local!tempDate, null),
            a!save(local!dateOne, local!tempDate)
        )
    }

Reply
  • Hi Bruno,

    Given what you're looking for I would do an if() statement within the saveInto. Something like the below. You can also have an validation parameter that shows up as expected when this happens so the user knows, you'd just have to validate based on the tempDate variable.

    saveInto: {
    local!tempDate,
        if(
            local!tempDate>local!dateTwo,
            a!save(local!tempDate, null),
            a!save(local!dateOne, local!tempDate)
        )
    }

Children
No Data