I am trying to add some filters to the data retrieved from an entity query and keep encountering an error

"An error occurred while retrieving the data. Details: The data source [jdbc/Appian] cannot be reached or its configuration is invalid. Details: could not extract ResultSet"

I keep encountering this error while trying to add some filters to the data retrieved from a query entity. The query runs fine and retrieves all the data, however, when I go to add some dynamic filters to this data I keep encountering this error. I am reaching out to see if anyone from the community has come across the same error and what solution worked for them. Basically trying to add a few specific data filters to a search bar in the application. Any suggestions are welcome. Thank you

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Guessing there's something in one of your filter definitions that doesn't work.

  • I created a stand-alone record type for the search bar assuming the same. This usually works for dynamic filters for multiple rows of data. But I still got the same error .

  • 0
    Certified Lead Developer
    in reply to jayal6616

    Having a hard time visualizing your problem. Code or screenshots could be helpful.

  • a!localVariables(

     local!showSearchGrid:false(),

    {

     rule!ComponentDisplaySectionLink(

       translations: ri!translations,

       show: local!showSearchGrid,

       label: ri!linkText,

       icon: ri!linkIcon,

       description: ri!linkDescription,

       showWhen: ri!showWhen

     ),

    a!gridField(

     data: a!recordData(

       recordType: 'recordType!{}process name',

       filters: {

         a!queryFilter(

           field: 'recordType!{}process name.fields.{CreatedBy}CreatedBy',

           operator: "=",

           value: tostring(loggedInUser())

         )

       }

       ),

     columns: {

       a!gridColumn(

         label: index(ri!translations, "global.request", null),

         value: fv!row['recordType!{}process name.fields.{RequestID}RequestID']

       ),

       a!gridColumn(

         label: index(ri!translations, "global.site", null),

         value: fv!row['recordType!{}process name.fields.{SiteEn}SiteEn']

       ),

       a!gridColumn(

         label: index(ri!translations,"global.tradeName",null),

         value: fv!row['recordType!{}process name.fields.{ProductNameEn}ProductNameEn']

       ),

       a!gridColumn(

         label: index(ri!translations,"global.manufacturer",null),

         value: fv!row['recordType!{}process name.fields.{ManufacturerNameEn}ManufacturerNameEn']

       ),

       a!gridColumn(

         label: index(ri!translations,"global.patientInitials", null),

         value: fv!row['recordType!{}process name.fields.{PatientInitials}PatientInitials']

       ),

       a!gridColumn(

         label: index(ri!translations, "global.created", null),

         value: fv!row['recordType!{}process name.fields.{Created}Created']

       )

     },

     showWhen: local!showSearchGrid

    )

    }

    )

  • 0
    Certified Lead Developer
    in reply to jayal6616

    This is a Record Type query. The error is likely not here as you said you were trying to add some user filters.

  • 0
    Certified Lead Developer
    in reply to jayal6616

    I have no idea. You said there was an issue with queryEntity but you posted a Record Type query.

  • Since the query entity was returning this error I created a record type entity as a work around. But the same error is occurring in this case as well. I can share the query entity code as well

  • load(

     local!gridSelection: a!gridSelection(

       pagingInfo: a!pagingInfo(

         startIndex: 1,

         batchSize: cons!process name ,

         sort: a!sortInfo(field: ri!sortAttribute)

       ),

       selected: index(

         ri!selectedObjects,

         ri!recordIDAttribute,

         null

       )

     ),

     local!showSearchGrid: false(),

     local!searchValue,

     with(

       local!enableSearch: not(rule!GLB_isEmpty(ri!searchAttributes)),

       local!datasubset: if(

         rule!GLB_valueOrDefault(local!showSearchGrid, false()),

         a!queryEntity_22r2(

           entity: ri!entity,

           fetchTotalCount: true(),

           query: a!query(

             pagingInfo: if(

               isnull(ri!gridSelection),

               local!gridSelection.pagingInfo,

               ri!gridSelection.pagingInfo

             ),

             logicalExpression: a!queryLogicalExpression(

               operator: "AND",

               filters: if(

                 rule!GLB_isEmpty(ri!additionalQueryFilters),

                 {},

                 ri!additionalQueryFilters

               ),

               logicalExpressions: if(

                 and(

                   local!enableSearch,

                   rule!GLB_hasValue(local!searchValue)

                 ),

                 {

                   a!queryLogicalExpression(

                     operator: "AND",

                     filters: {

                       if(

                         rule!GLB_isEmpty(ri!searchAttributes),

                         {},

                         a!forEach(

                           items: ri!searchAttributes,

                           expression: a!queryFilter(

                             field: index(fv!item, "Name", null),

                             operator: choose(

                               wherecontains(

                                 tostring(index(fv!item, "Type", null)),

                                 touniformstring({ "INTEGER", "TEXT" })

                               ),

                               "=",

                               "includes"

                             ),

                               value:choose(

                               wherecontains(

                                 tostring(index(fv!item, "Type", null)),

                                 touniformstring({ "INTEGER", "TEXT" })

                               ),

                               if(

                                 isnull(tointeger(local!searchValue)),

                                  1,

                                 tointeger(local!searchValue)

                               ),

                               tostring(local!searchValue)

                             ),

                             applyWhen: not(rule!GLB_isBlank(local!searchValue))

                           )

                         )

                       ),

                       /*new code*/

                       if(

                         ri!entity = cons!process name,

                         a!queryFilter(

                           field: "IsArchived",

                           operator: "=",

                           value: false()

                         ),

                         {}

                       )

                       /*new code*/

                     },

                     ignoreFiltersWithEmptyValues: true()

                   )

                 },

                 {}

               )

             )

           )

         ),

         todatasubset({})

       ),

       local!moreThanMaxselections: and(

         not(rule!GLB_isBlank(ri!maxSelections)),

         rule!GLB_length(

           if(

             isnull(ri!gridSelection),

             local!gridSelection.selected,

             ri!gridSelection.selected

           )

         ) > ri!maxSelections

       ),

       {

         rule!process name(

           translations: ri!translations,

           show: local!showSearchGrid,

           label: ri!linkText,

           icon: ri!linkIcon,

           description: ri!linkDescription,

           showWhen: ri!showWhen

         ),

         a!columnsLayout(

           showWhen: and(

             local!showSearchGrid,

             local!enableSearch

           ),

           columns: {

             a!columnLayout(

               contents: {

                 a!textField(

                   label: "Search",

                   value: local!searchValue,

                   saveInto: {

                     local!searchValue,

                     a!save(

                       if(

                         isnull(ri!gridSelection),

                         local!gridSelection.pagingInfo.StartIndex,

                         ri!gridSelection.pagingInfo.StartIndex

                       ),

                       1

                     )

                   }

                 )

               }

             ),

             a!columnLayout(contents: {}),

             a!columnLayout(contents: {})

           }

         ),

         a!gridField_19r1(

           showWhen: local!showSearchGrid,

           identifiers: index(

             local!datasubset.data,

             ri!recordIDAttribute,

             {}

           ),

           selection: true(),

           selectionStyle: "ROW_HIGHLIGHT",

           totalCount: index(local!datasubset, "totalCount", 0),

           value: if(

             isnull(ri!gridSelection),

             local!gridSelection,

             ri!gridSelection

           ),

           saveInto: if(

             isnull(ri!gridSelection),

             local!gridSelection,

             ri!gridSelection

           ),

           columns: a!forEach(

             items: ri!columnAttributes,

             expression: with(

               local!columnList: index(

                 local!datasubset.data,

                 stripwith(fv!item, " "),

                 {}

               ),

               a!gridTextColumn(

                 label: if(

                   rule!GLB_isEmpty(ri!columnLabels),

                   fv!item,

                   index(ri!columnLabels, fv!index, null)

                 ),

                 field: stripwith(fv!item, " "),

                 data: if(

                   contains({ "Created", "Updated" }, fv!item),

                   apply(

                     rule!GLB_displayDate(date: _),

                     local!columnList

                   ),

                   if(

                     contains({ "Province" }, fv!item),

                     apply(

                       rule!process name(key: _, translations: ri!translations),

                       local!columnList

                     ),

                     local!columnList

                   )

                 ),

                 links: if(

                   contains({ "Record ID", "Request ID" }, fv!item),

                   apply(

                     a!recordLink(

                       recordType: con! Process name,

                       identifier: _

                     ),

                     local!columnList

                   ),

                   {}

                 )

               )

             )

           ),

           validations: {

             if(

               local!moreThanMaxselections,

               index(

                 ri!translations,

                 "sectionSearchableSelectionList.warning1part1",

                 {}

               ) & " " & ri!maxSelections & " " & index(

                 ri!translations,

                 "sectionSearchableSelectionList.warning1part2",

                 {}

               ),

               {}

             )

           }

         ),

         a!buttonArrayLayout(

           align: "END",

           buttons: {

             a!buttonWidget(

               label: index(ri!translations, "global.clear", {}),

               showWhen: local!showSearchGrid,

               confirmMessage: index(

                 ri!translations,

                 "sectionSearchObjects.clearConfirm",

                 {}

               ),

               disabled: rule!GLB_isEmpty(

                 if(

                   isnull(ri!gridSelection),

                   local!gridSelection.selected,

                   ri!gridSelection.selected

                 )

               ),

               saveInto: {

                 a!save(ri!selectedObjects, null),

                 if(

                   isnull(ri!gridSelection),

                   a!save(local!gridSelection.selected, null),

                   a!save(ri!gridSelection.selected, null)

                 ),

                 a!save(local!showSearchGrid, false()),

                 ri!additionalClears

               }

             ),

             a!buttonWidget(

               label: ri!buttonText,

               style: "PRIMARY",

               showWhen: local!showSearchGrid,

               disabled: or(

                 rule!GLB_isEmpty(

                   if(

                     isnull(ri!gridSelection),

                     local!gridSelection.selected,

                     ri!gridSelection.selected

                   )

                 ),

                 local!moreThanMaxselections

               ),

               saveInto: {

                 a!save(

                   ri!selectedObjects,

                   cast(

                     ri!objectType,

                     index(

                       rule! Name queryEntity(

                         entity: ri!entity,

                         recordIDList: index(

                           if(

                             isnull(ri!gridSelection),

                             local!gridSelection,

                             ri!gridSelection

                           ),

                           "selected",

                           {}

                         ),

                         attribute: ri!recordIDAttribute

                       ),

                       "data",

                       {}

                     )

                   )

                 ),

                 a!save(local!showSearchGrid, false()),

                 ri!additionalSaves

               }

             )

           }

         )

       }

     )

    )

  • 0
    Certified Lead Developer
    in reply to jayal6616

    FWIW, this latest comment is essntially unreadable, and makes the therad pretty much unreadable as well.  Please edit your comment and re-paste the code using a Code Box (make sure you re-copy from the source so it retains indentation).