I'm getting a missing parenthesis error - but everything looks fine?

edited June 25, 2020 in Questions
Hello,

I've created quite a complex model condition, which by rights should work. However the ordering doesn't seem to be functioning properly. Here is the conditional part of the model (in XML):

<conditions logic="                1 AND 2 AND 3 AND 36 AND 37 AND 
                ((28 AND (12 OR 13 OR 14 OR 15 OR 16 OR 17 OR 18 OR 19 OR 20 OR 21)) OR (33 AND 35))
                AND 
                ((29 AND (22 OR 23 OR 24)) OR (31 AND (25 OR 26 OR 27)))
                AND
                (30 AND (7 OR 8 OR 9 OR 10 OR 11) OR (32 AND 34))">


            <condition type="fieldvalue" value="false" enclosevalueinquotes="false" field="IsDeleted"/>
            <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="EPP__r.EPP_Approved__c"/>
            <condition type="fieldvalue" value="TODAY" enclosevalueinquotes="false" field="Project_Expiry_Date__c" operator="gt"/>
            <condition type="multiple" field="Project_Stage__c" operator="in" inactive="true" enclosevalueinquotes="true" name="__autofilter__Project_Stage__c" state="filterableoff" value=""/>
            <condition type="multiple" field="Project_Focus_Area__c" operator="includes" inactive="true" enclosevalueinquotes="true" name="__autofilter__Project_Focus_Area__c" state="filterableoff" value=""/>
            <condition type="multiple" field="Project_Investment__c" operator="in" inactive="true" enclosevalueinquotes="true" name="__autofilter__Project_Investment__c" state="filterableoff" value=""/>
            <condition type="modelmerge" value="" field="Project_Focus_Area__c" operator="includes" model="Running_User" enclosevalueinquotes="true" mergefield="Focus_Area_1a__c" novaluebehavior="noquery" state=""/>
            <condition type="modelmerge" value="" field="Project_Focus_Area__c" operator="includes" model="Running_User" enclosevalueinquotes="true" mergefield="Focus_Area_2a__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="Project_Focus_Area__c" operator="includes" model="Running_User" enclosevalueinquotes="true" mergefield="Focus_Area_3a__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="Project_Focus_Area__c" operator="includes" model="Running_User" enclosevalueinquotes="true" mergefield="Focus_Area_4a__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="Project_Focus_Area__c" operator="includes" model="Running_User" enclosevalueinquotes="true" mergefield="Focus_Area_5a__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_1_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_2_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_3_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_4_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_5_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_6_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_7_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_8_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_9_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP_Account__c" operator="contains" model="Running_User" enclosevalueinquotes="true" mergefield="Company_10_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_1_Filter_A__c" novaluebehavior="noquery" state="" inactive="false"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_2_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_3_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="!=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_1_Filter_A__c" novaluebehavior="noquery" state="" inactive="false"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="!=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_2_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.Contact__r.Industry__c" operator="!=" model="Running_User" enclosevalueinquotes="true" mergefield="Industry_3_Filter_A__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="=" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Accounts__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="=" userinfotype="userid" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Industries__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="=" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Focus_Areas__c" novaluebehavior="noquery" state=""/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="!=" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Industries__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="!=" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Focus_Areas__c" novaluebehavior="noquery"/>
            <condition type="modelmerge" value="" field="EPP__r.EPP_Approved__c" operator="!=" model="Running_User" enclosevalueinquotes="false" mergefield="Filter_A_Accounts__c" novaluebehavior="noquery"/>
            <condition type="blank" value="null" field="Project_Focus_Area__c" operator="!=" mergefield="Focus_Area_1a__c" novaluebehavior="noquery" state="" enclosevalueinquotes="false"/>
            <condition type="multiple" value="" field="EPP_Account__c" operator="in" mergefield="Company_1_Filter_A__c" novaluebehavior="noquery" enclosevalueinquotes="true" state="">
               <values>
                  <value>a</value>
                  <value>b</value>
                  <value>c</value>
                  <value>d</value>
                  <value>e</value>
                  <value>f</value>
                  <value>g</value>
                  <value>h</value>
                  <value>i</value>
                  <value>j</value>
                  <value>k</value>
                  <value>l</value>
                  <value>m</value>
                  <value>n</value>
                  <value>o</value>
                  <value>p</value>
                  <value>q</value>
                  <value>r</value>
                  <value>s</value>
                  <value>t</value>
                  <value>u</value>
                  <value>v</value>
                  <value>w</value>
                  <value>x</value>
                  <value>y</value>
                  <value>z</value>
               </values>
            </condition>
            <condition type="blank" value="null" field="EPP_Account__c" operator="!=" enclosevalueinquotes="false"/>
            <condition type="blank" value="null" field="Project_Focus_Area__c" operator="!=" enclosevalueinquotes="false"/>
         </conditions>
         <actions/>
      </model>
   </models>



But the error message I receive shows this:

1. An error occurred while attempting to perform the following SOQL query: SELECT CreatedBy.Name,EPP_Account__c,EPP_Contact_Name__c,EPP_Event__c,Name,EPP_VIdeo_URL__c,Event_Name__c,Project_Description__c,Project_Expiry_Date__c,Project_Focus_Area__c,Project_Investment__c,Project_Stage__c,Project_Timeline__c,Stage_Timeline__c,Total_Budget__c,Total_EPP_Project_Points__c,Id FROM EPP_Project__c WHERE (IsDeleted = false)AND(EPP__r.EPP_Approved__c = true)AND(Project_Expiry_Date__c > TODAY)AND(EPP_Account__c != null)AND(Project_Focus_Area__c != null)AND(((EPP__r.EPP_Approved__c = false)AND((EPP_Account__c LIKE '%Google%')OR(EPP_Account__c LIKE '%Yahoo%')OR(EPP_Account__c LIKE '%Barclay%')OR(EPP_Account__c LIKE '%Amazon%')OR(EPP_Account__c LIKE '%Natwest%')OR(EPP_Account__c LIKE '%RBS%')OR(EPP_Account__c LIKE '%Royal Bank of Scotland%')OR(EPP_Account__c LIKE '%Tesco%')OR(EPP_Account__c LIKE '%Walmart%')OR(EPP_Account__c LIKE '%Asda%')))OR((EPP__r.EPP_Approved__c != false)AND(EPP_Account__c in ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'))))AND(((EPP__r.EPP_Approved__c = false)AND((EPP__r.Contact__r.Industry__c = 'Oil & Gas')OR(EPP__r.Contact__r.Industry__c = 'Marketing & Media')OR(EPP__r.Contact__r.Industry__c = 'Financial Services')))OR((EPP__r.EPP_Approved__c != false)AND((EPP__r.Contact__r.Industry__c != 'Oil & Gas')OR(EPP__r.Contact__r.Industry__c != 'Marketing & Media')OR(EPP__r.Contact__r.Industry__c != 'Financial Services'))))AND((EPP__r.EPP_Approved__c = true)AND((Project_Focus_Area__c includes ('5G'))OR(Project_Focus_Area__c includes ('Analytics'))OR(Project_Focus_Area__c includes ('Hydraulic Fracturing'))OR(Project_Focus_Area__c includes ('Audience & Market Data'))OR(Project_Focus_Area__c includes ('Leadership Development')))OR((EPP__r.EPP_Approved__c != true)AND(Project_Focus_Area__c != null)))) LIMIT 2001 Error:expecting a right parentheses, found 'OR'



I've checked the parenthesis loads of times, and it should be right, but when it's being parsed, it seems to be putting extra brackets in, breaking the code. 

Any ideas?

Comments

  • Pat VachonPat Vachon 💎💎💎
    edited June 25, 2020
    Hmmm ... the logic text. Does it have break points in it? It should be a continuous string.
  • edited October 26, 2016
    Only while I was debugging it. The actual string is :

    1 AND 2 AND 3 AND 36 AND 37 AND ((28 AND (12 OR 13 OR 14 OR 15 OR 16 OR 17 OR 18 OR 19 OR 20 OR 21)) OR (33 AND 35)) AND ((29 AND (22 OR 23 OR 24)) OR (31 AND (25 OR 26 OR 27))) AND (30 AND (7 OR 8 OR 9 OR 10 OR 11) OR (32 AND 34))

    But I still get the same error. 

    It seems that extra close brackets get added at around 35...
  • edited October 26, 2016
    Ok sorted! My lead developer took a look, added another set of brackets, and it magically worked! Phew :D
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!