Question

Photo of Michael Garrison

0

This data view isn't working- can I get some more eyes on my setup please?

I've made some stupid mistake somewhere, I have no doubt.

Our church has a program called "Safe Church" wherein all of the volunteers and workers who interact with kids have to go through various checks every 3 years. I've created Person Attributes in the "Safety and Security" category to track the records (and set the boolean values to default to False/No). But we need a list that tells us if anyone is overdue for their checks.

All of the people in question are in a single group within Rock.

So I've created a data view that, at it's core, should show people in that group AND where ANY of the attributes I created are set to false. Of course, some of the attributes are dates (which don't have a default) so rather than checking for false on those, I set them to display if the date is less than "Current Date" minus 3 years (1095 days). Further complicating matters, some of the checks can't be performed on people less than 18 years of age, so I have to have it not consider those values if they are 17 or less.

Goofy logic, but I thought I'd worked it all out:

OutOfCurrency_dataview.png

Unfortunately, even though everyone in that group has blank dates and the default "No"  for each of the attributes, the list is blank.

So one of my bits is flipped or something. But it seems to me that since I know people in the group are over 18 and have, for instance, "Safe Church - Id" set to "No" (false), that should be all it takes to trigger them showing up in the list.

Can anyone spot my mistake?

Thanks

  • Photo of David Leigh

    0

    Ok, after playing around with this it seems that the problem arises because you are trying to match to the default value of the Attribute ("False").
    Under the hood, Rock only stores a record in the AttributeValue database table if it differs from the default value.
    However, the Data Filter only looks at the records stored in the AttributeValue table for matching values, without regard to the default value - there are no records for the default value, so no records can be matched.

    This is a bug - until it is fixed, the only workaround I can think of is to remove the default value, which will force Rock to store the value explicitly.

    Hope this helps.

    • Michael Garrison

      It certainly does- should I file a bug report or are you on it?


      I'm sure it's related but this seems even more confusing with that answer- why won't "is blank" work with a date attribute?


      http://rock.rocksolidchurchdemo.com/page/145?DataViewId=16


      I understand the bug of not checking for a default value, but isn't that expressly what "Is Blank" is supposed to detect? There's not really any way to NOT set "blank" as the default (without providing a date) so I can't think of a similar workaround- can you?

    • David Leigh

      The bug affecting "Is Blank" filters for Attributes that I directed you to was caused by a similar problem - it was only filtering from those records that had an Attribute Value already defined (none of which would be blank!), not returning records that had no Attribute Value at all. So in the case of both blank and default values, there is no value stored in the AttributeValue table. A fix for the "Is Blank" issue is already in the next version, but the issue with regard to default values requires another fix.


      I have logged the issue here:
      https://github.com/SparkDevNetwork/Rock/issues/1259

  • Photo of David Leigh

    0

    Michael,

    It might help to simplify your problem by breaking the filter groups into separate Data Views so you can narrow down which set of filters is not returning the correct results?

    Hard to say due to the complexity of your query, but I suspect the problem may be caused by filtering on some of the Attributes because I have run into similar problems myself.
    For example, see this issue:
    https://github.com/SparkDevNetwork/Rock/issues/988

    Hope this helps.

     

    • Michael Garrison

      David, you're right of course- I should have started by running simpler incremental tests.


      But now some extremely basic tests are failing, so there seems to be a larger issue going on.


      I created a test with "In group: Childcare Workers AND (Safe Church - References is False OR Safe Church - ID is False)" and it was still empty. I took it down to just a single boolean check, and the group is STILL empty.


      Likewise, I tried tests with the date values - "In Group: Childcare Workers AND Safe Church - Interview is less than Current Date minus 1095 days" as well as "...AND Safe Church - Interview is blank" and in both cases the result was empty.


      So then I created a data view with no filter groups at all- just "In Group: Childcare Workers AND Safe Church - ID is False", and it's STILL empty. At this point I don't seem to be able to combine a filter for people in that group with any other filter at all (a filter for just people in that group does work however).


      Let me run some similar tests on the RockSolidChurch demo site and report back

  • Photo of Michael Garrison

    0

    OK, I've re-created the issue on rocksolidchurchdemo:

    http://rock.rocksolidchurchdemo.com/page/145?DataViewId=15

    Not knowing what might contribute to the issue, I've mostly re-created our ministry team heirarchy in the groups and added a few people to the group. I've also created a person attribute called "Safe Church - ID" and assigned it to Safety & Security. It's a boolean attribute using "Yes" for true and "No" for false (the default). Basic.

    But you can see at the above page that the data view returns an empty set, even though I've just asked for a list of people in that group where the Safe Church - ID boolean is false (which is all 3 of them, as you can see in their extended attributes page).