1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.
    Dismiss Notice

bug in pre-filter Condition

Discussion in 'Community' started by samani, May 14, 2018.

  1. samani

    samani Member

    Level: Community
    hi
    when i use "NOT IN" or use "IN" give the same result, can you check that?for example i want to get list of users not in superuser group . i use this:
    return JAccess::getUsersByGroup(8);
     
    Last edited: May 14, 2018
  2. troester

    troester Administrator Staff Member

    Level: Community
    IN needs something like (1,2,3)
     
  3. samani

    samani Member

    Level: Community
    you day right but look at my example:
    i have user A B C D E F
    A , B is super admin
    when i use prefilter:
    1)
    IN Eval( return JAccess::getUsersByGroup(8); )
    ==> A,B
    2)
    NOT IN Eval( return JAccess::getUsersByGroup(8); )
    ==> A,B
    3)
    when i don't use any prefilter
    ==> A,B,C,D,E,F
     
  4. Bauer

    Bauer Well-Known Member

    Level: Supporter
    I don't think you should preface the 'Value' value with the word 'return'.
    A 'return' is already assumed when you select 'Eval' as Type.

    So there is no "bug". It's not that "NOT IN" or "IN" gives the same result.
    Either way, as troester explained, the reason it fails is because your 'Value' is returning an array ( getUsersByGroup() ) when, in fact, the mySQL IN() function expects a string.

    Try using
    implode(",",JAccess::getUsersByGroup(8))
    as the 'Value' value to which a php 'Eval' should be applied.
    (Which should then return a comma delimited string of all the userIds in the '8' user group - which is what you would want to be used with the 'IN' Condition.)
     
    Last edited: May 16, 2018
    troester and samani like this.
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    You do need the return.

    I can't recall if we aytomatically add the parens, I think we do. So ...

    Code (Text):

    return implode(",",JAccess::getUsersByGroup(8));
     
    -- hugh
     
    samani likes this.
  6. Bauer

    Bauer Well-Known Member

    Level: Supporter
    If I only took the time to test I would have figured that out for myself and saved the embarrassment. Oh well - I did say "I don't think".:oops:
     
    cheesegrits likes this.

Share This Page