Applying complex Query

youssef_effat
Tera Contributor

Hello,

I have an issue querying the sys_dictionary table with a complex query of this type :

 

CdtA AND ( CdtX OR  CdtY OR (CdtZ1 AND CdtZ2))

Cdt : condition

Problem : cannot put a mix of OR and AND in the conditions

 

I have developed the expression with boolean logic :

(CdtX AND CdtA ) OR  (CdtY AND CdtA ) OR (CdtZ1 AND CdtZ2 AND CdtA))

The query become much slower (the CdtA is so long and its applied three times this time)

 

Does anyone have an idea to apply this type of complex queries easily??

 

here is the actualy qeury :

 

 constructQueries: function(objectTable, allDataTables, tablesToSkip) {

        var tableLabel = this.getTableLabel(objectTable);

        // QUERIES

 

        // dict entries of type reference and the reference is twoards the object type (eg. Group)

        var referencesQuery = 'referenceCONTAINS' + tableLabel;

 

        // dict entries of type script

        var scriptsQuery = 'internal_typeLIKEscript';

 

        // var documentQuery = 'internal_type=document_id';

 

        // var conditionsQuery = 'internal_type=conditions';

 

        var stringScriptQeury = 'internal_type.label=string^elementLIKEscript';

 

        // exclude all data entries of specifique tables

        var skipTablesQuery = 'nameNOT LIKE' + tablesToSkip.join('^nameNOT LIKE');

 

        return {

            mainQuery: referencesQuery + '^' + skipTablesQuery + '^NQ' + scriptsQuery + '^' + skipTablesQuery + '^NQ' + stringScriptQuery + '^' + skipTablesQuery

        };

    },

 

1 REPLY 1

Sanjay191
Tera Sage

Hello @youssef_effat 
Could you please give me more input on this