record\findOne with condition NOT IN LIST

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arturkulik
    Member
    • Apr 2025
    • 49

    #1

    record\findOne with condition NOT IN LIST

    Hi, i'm using espo 9.1.8 i wonder how i can get condition for 'status' attribute not in list

    i can have 'status' in one of the list :

    'status', list('Not Started','Started')

    but how to make opposite condition NOT in the list?

    probably in Espo 9.2 i can make it with:

    $where = object\create();
    $where['type'] = 'and';
    $where['value'] = list(
    (
    $it = object\create();
    $it['type'] = 'not equals';
    $it['attribute'] = 'status';
    $it['value'] = 'Completed';
    $it;
    ),
    (
    $it = object\create();
    $it['type'] = 'not equals';
    $it['attribute'] = 'status';
    $it['value'] = 'Cancelled';
    $it;
    )
    );


    $toCreate=record\findMany('Task', 10, 'createdAt', 'desc', $where);


    but i can not upgrade Espo version tight now
    Last edited by arturkulik; 10-02-2025, 09:24 AM.
  • lazovic
    Super Moderator
    • Jan 2022
    • 1167

    #2
    Hi arturkulik,

    You can use the following formula script:
    Code:
    record\findMany('Task', 1000, 'createdAt', 'desc', 'status!=', list('Completed', 'Cancelled'));

    Comment


    • arturkulik
      arturkulik commented
      Editing a comment
      I've tried, but it was not working properly
  • lazovic
    Super Moderator
    • Jan 2022
    • 1167

    #3
    arturkulik,

    You can share details and screenshots of the problem, and we will try to figure it out together.

    Comment

    Working...