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
    in reply to jayal6616
    done

    it still looks exactly the same to me?  did you save your changes?  (when done editing your comment you need to press the "Reply" button again to commit your changes, fwiw).

  • 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_ComponentDisplaySectionLink(
            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!name_getTranslationIfExists(key: _, translations: ri!translations),
                        local!columnList
                      ),
                      local!columnList
                    )
                  ),
                  links: if(
                    contains({ "Record ID", "Request ID" }, fv!item),
                    apply(
                      a!recordLink(
                        recordType: cons!SAP_RECORDTYPE_DRUGREQUEST,
                        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

    Hard to say. But could this part might be the cause?

    What's in that constant? Also, how can it have a space in the name?

    batchSize: cons!process name ,

  • I have edited it to avoid posting any actual application names. There is no space in the real code. In the code it is             

    batchsize: cons!name_PAGING_BATCHSIZE_OBJECTSEARCH

  • 0
    Certified Associate Developer
    in reply to jayal6616

    Hi did you find any solution on this issue, I also faced while filtering data through record search