Error code 4145 Assistance

  • Hi there,

    I seem to be getting this error on this querey and cant seem to figure it out - please help

    (((((woclass = 'WORKORDER' or woclass = 'ACTIVITY') and historyflag = 0 and siteid = 'CORE')

    and status not in (select value from synonymdomain where domainid = 'WOSTATUS' and maxvalue in ('CAN', 'FINCOMP','CLOSE','REASSIGNED','REASSIGNED' ))

    and (ownergroup is null or ownergroup = '' or ownergroup = 'ISD-CIVL')

    and (crewid is null or crewid = '' or crewid like 'C%')

    and istask or parent = 1 and worktype = 'CM'

    and supervisor not in ('500228','443218', '453106', '135300', '307107', '303005', '302706', '312022', '312009', '500075', '500282', '500451', '302704', '317361', '321237', '308558', '305055', '206596', '137885', '110017', '109456','135540', '312268', '435115', '453065', '444304', 'X00014','X00012','500048'))) and not ((status = 'FINCOMP')))

  • Error 4145 is:

    An expression of non-boolean type specified in a context where a

    condition is expected

    Looks like the "istask" clause is missing a matching statement.

    ie. istask = 1

    Also space out your brackets to make it readable. The "or parent = 1" is going to cause some issues, negating all the other AND statements.

    Too many brackets too.

    Also change "and not ((status = 'FINCOMP'))" to "and (status <> 'FINCOMP')

    (

    (

    (

    (

    (woclass = 'WORKORDER' or woclass = 'ACTIVITY')

    and historyflag = 0 and siteid = 'CORE'

    )

    and status not in (select value from synonymdomain where domainid = 'WOSTATUS' and maxvalue in ('CAN', 'FINCOMP','CLOSE','REASSIGNED','REASSIGNED' ))

    and (ownergroup is null or ownergroup = '' or ownergroup = 'ISD-CIVL')

    and (crewid is null or crewid = '' or crewid like 'C%')

    and istask

    or parent = 1

    and worktype = 'CM'

    and supervisor not in ('500228','443218', '453106', '135300', '307107', '303005', '302706', '312022', '312009', '500075', '500282', '500451', '302704', '317361', '321237', '308558', '305055', '206596', '137885', '110017', '109456','135540', '312268', '435115', '453065', '444304', 'X00014','X00012','500048')

    )

    )

    and not ((status = 'FINCOMP'))

    )

  • Thanks Andrew,

    Tried that and now it comes up with with a different error 102. So this is what I have now put in as you suggested. Doing my head but I think getting close

    (((woclass = 'WORKORDER' or woclass = 'ACTIVITY') and historyflag = 0 and siteid = 'CORE')

    and status not in (select value from synonymdomain where domainid = 'WOSTATUS' and maxvalue in ('CAN', 'FINCOMP','CLOSE' ))

    and (ownergroup is null or ownergroup = '' or ownergroup = 'ISD-CIVL')

    and (crewid is null or crewid = '' or crewid like 'C%')

    and istask = 1, and isparent =1, and worktype = 'CM'

    and supervisor not in ('500228','443218', '453106', '135300', '307107', '303005', '302706', '312022', '312009', '500075', '500282', '500451', '302704', '317361', '321237', '308558', '305055', '206596', '137885', '110017', '109456','135540', '312268', '435115', '453065', '444304', 'X00014','X00012','500048')) and not ((status = 'FINCOMP'))

  • Error 105, incorrect syntax near...

    There should not be commas after the

    istask = 1,

    AND

    isparent =1,

    I've removed the brackets and commas below:

    If you keep finding issues, just run the statement without each WHERE clause, then add each statement in until you get an error.

    (woclass = 'WORKORDER' OR woclass = 'ACTIVITY')

    AND historyflag = 0

    AND siteid = 'CORE'

    AND status NOT IN

    (

    SELECT value

    FROM synonymdomain

    WHERE domainid = 'WOSTATUS'

    AND maxvalue IN ('CAN',

    'FINCOMP',

    'CLOSE' )

    )

    AND

    (

    ownergroup IS NULL OR

    ownergroup = '' OR

    ownergroup = 'ISD-CIVL'

    )

    AND

    (

    crewid IS NULL OR

    crewid = '' OR

    crewid LIKE 'C%'

    )

    AND istask = 1

    AND isparent =1

    AND worktype = 'CM'

    AND supervisor NOT IN ('500228',

    '443218',

    '453106',

    '135300',

    '307107',

    '303005',

    '302706',

    '312022',

    '312009',

    '500075',

    '500282',

    '500451',

    '302704',

    '317361',

    '321237',

    '308558',

    '305055',

    '206596',

    '137885',

    '110017',

    '109456',

    '135540',

    '312268',

    '435115',

    '453065',

    '444304',

    'X00014',

    'X00012',

    '500048')

    AND NOT status = 'FINCOMP'

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply