Skip to main content
October 22, 2024
Solved

How to filter negative values from readonly grid

  • October 22, 2024
  • 24 replies
  • 1 view

I have a requirement to filter negative values from readonly  grid and It needs to get configured from expression rule but Im not able to filter the negative values.

I tried using "<" as operator for that particular field but still not filtering out.

please help me achieve this

    Best answer by mikes0011
    you mean to say i have to use sum() add 1 to selected value ?

    sum() doesn't really play into this.  you can simply add 1 to the user-entered value when feeding it into your queryFilter.  If you're not sure how to do that, you can post the actual code from your queryfilter and i can tell you how to modify it.  Generally you'd put something like,

    a!queryFilter(
      field: "latitude",
      operator: "<",
      value: ri!userSelectedValue + 1
    )

    24 replies

    mikes0011
    Brainy
    October 22, 2024

    Please share the actual code you've tried so we can make informed comments.  Generally an a!queryFilter(), when filtering on a numeric value, should accept the "<" operator just fine, but any number of other things could have gone wrong before it even gets that far, and it's hard to guess without seeing exactly what you've tried and exactly what went wrong.

    October 23, 2024

    hi mike thankyou for responding

    my requirement is I have to make a filter for latitude and longitude as latitude from latitude to and longitude from longitude to when user put some values in latitude from and latitude to then it filters the values between those values from grid

    for reference : 

    here i wan values above 42 as well like 42.2 but just getting values between 41 and 42
    if there is any solution please let me know

    mikes0011
    Brainy
    October 23, 2024

    if you want a value like 42.2 to be included then your "to" filter entry should be 43.  Or you could just override the filter value and add 1 to whatever the user enters, so it would match all values up to the next higher integer (you'd just need to test it well to make sure different corner cases work like you expect).

    kumara0180
    October 22, 2024

    are you trying to filter values which does not match a condition. Example :- Filter values which are not equals to 1 or "ABC", if so then using <>  operator might works for you.

    Also you can use Appian query editor on top side of expression rule for guided development for writing these type of query.

    October 23, 2024

    thankyou for responding

    hi mike thankyou for responding

    my requirement is I have to make a filter for latitude and longitude as latitude from latitude to and longitude from longitude to when user put some values in latitude from and latitude to then it filters the values between those values from grid

    for reference : 

    here i want values above 42 as well like 42.2 but just getting values between 41 and 42
    if there is any solution please let me know

    kumara0180
    October 24, 2024

    based on your screen shot, I am assuming when user is typing 42 then you need to show the values from 41 till 42.99, if so you would need to run the filter after incrementing the typed value by 1. in this case it is 43. 

    prasantap0900
    October 23, 2024

    Please ignore the field, I have used (-) in contact number just for testing purpose and here is the result. Maybe it will be helpful for you.

    October 23, 2024

    thankyou prasanta for responding 

    hi mike thankyou for responding

    my requirement is I have to make a filter for latitude and longitude as latitude from latitude to and longitude from longitude to when user put some values in latitude from and latitude to then it filters the values between those values from grid

    for reference : 

    here i want values above 42 as well like 42.2 but just getting values between 41 and 42
    if there is any solution please let me know

    October 23, 2024

    For testing purpose I used the some value and here is the result. Maybe it will be helpful for you.

    October 23, 2024

    thankyou [mention:72ffa644327e4fa197837686e1eca5d8:e9ed411860ed4f2ba0265705b8793d05]  for responding 

    hi mike thankyou for responding

    my requirement is I have to make a filter for latitude and longitude as latitude from latitude to and longitude from longitude to when user put some values in latitude from and latitude to then it filters the values between those values from grid

    for reference : 

    here i want values above 42 as well like 42.2 but just getting values between 41 and 42
    if there is any solution please let me know

    vigneshkumarr0001
    October 23, 2024

    Hi, please try the below code, as mike said increment that end value & check both < and >= in query filter with ri!latTo+ 1 and remove the extra query filter "between" query filter. Hope this will works for you.


    a!queryFilter(
    field: 'recordType!{9441efd7-521a-4695-82a7-d661a237c67d}.fields.{499d2d44-21c8-41dc-a3be-2dbd3ee0356f}',
    operator: ">=",
    value: ri!latFrom,
    applyWhen: and(
    not(rule!APN_isEmpty(ri!latFrom)),
    rule!APN_isEmpty(ri!latTo)
    )
    ),
    a!queryFilter(
    field: 'recordType!{9441efd7-521a-4695-82a7-d661a237c67d}.fields.{499d2d44-21c8-41dc-a3be-2dbd3ee0356f}',
    operator: "<=",
    value: ri!latTo + 1,
    applyWhen: and(
    not(rule!APN_isEmpty(ri!latTo)),
    rule!APN_isEmpty(ri!latFrom)
    )
    ),