Skip to main content
New Participant
Jul 24, 2024 9:33 AM UTC
Question

Searching from Database with not matching two word

I want search all records with not matching two keyword (CLOS & CANS) like:

1. ADVG XCLT QRPR

2. ADVG CLOS QRPR

3. ADVG CLOS CANS

4. ADVG PQRS QRPR

from the 4 rows I want to display first and last rows. Rows having two word like CLOS and CANS shall not be display.

So, I want to know which keyword I shall use in query function. Not Includes function work only on keyword. But this query have more than one keyword. Please advice.

    10 replies

    venkatrea696188
    Inspiring
    Jul 24, 2024 10:00 AM UTC

    Can't we achieve it through  Querylogic  "AND"  with multiple Queryfilters 

    pragnaj0001
    Inspiring
    Jul 24, 2024 10:03 AM UTC

    if u r using query record type, u can use list of query filters . if u r using db, u can using logical expression "AND".  

    Brainy
    Jul 24, 2024 11:35 AM UTC

    You can try 'not includes' parameter. See the sample code for reference:

    filters: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: 'recordType!xxx.fields.abc',
            operator: "not includes",
            value: "CLOS"
          ),
          a!queryFilter(
            field: 'recordType!xxx.fields.abc',
            operator: "not includes",
            value: "CANS"
          )
        },
        ignoreFiltersWithEmptyValues: true
      )

    New Participant
    Jul 24, 2024 11:50 AM UTC

    Thanks for your reply. but I want to call like this with single value selection from dropdown like:

    filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: 'recordType!xxx.fields.abc',
    operator: "not includes",
    value:{ "CLOS", "CANS"}
    ),
    },
    ignoreFiltersWithEmptyValues: true
    )

    So I want to know if it is possible or not or which operation I have to use.

    Brainy
    Jul 24, 2024 12:03 PM UTC
    No. You need to dynamically append a!queryFilter based on selection.
    a!queryFilter(
            field: 'recordType!XYZ.fields.abc',
            operator: "not includes",
            value: "Selected Value"
          )
    prasantap0900
    Participating Frequently
    Jul 31, 2024 6:33 AM UTC

    a!queryRecordType(
    recordType: recordType!abc,
    filters: {
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CLOS"
    ),
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CONS"
    )
    },
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    )

    -------------------------------------------------------------------------------------
    a!queryRecordType(
    recordType: recordType!abc,
    filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CLOS"
    ),
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CONS"
    )
    }
    ),
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    )

    konduruc733182
    Inspiring
    Jul 31, 2024 6:35 AM UTC

    prasantap0900
    Participating Frequently
    Jul 31, 2024 11:36 AM UTC

    thanks for suggesting me [mention:2df2892a4df7486f9775b4d2f0e405fd:e9ed411860ed4f2ba0265705b8793d05] 

    a!queryRecordType(
    recordType: recordType!abc,
    filters: {
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CLOS"
    ),
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CONS"
    )
    },
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    )
    
    -------------------------------------------------------------------------------------
    a!queryRecordType(
    recordType: recordType!abc,
    filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CLOS"
    ),
    a!queryFilter(
    field: recordType!abc.xyz,
    operator: "not includes",
    value: "CONS"
    )
    }
    ),
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    )