Visual Builder

Get Involved. Join the Conversation.

Topic

    NG NG
    Search Page not workingAnswered
    Topic posted July 17, 2019 by NG NGBlue Ribbon: 750+ Points, tagged Action Flows, Custom Code, UI 
    62 Views, 5 Comments
    Title:
    Search Page not working
    Summary:
    Search Page not working
    Content:

    Hi,

    We have custom Search Page having search on 4 columns which is displaying a table having 8 columns.

    If we provide search criteria in just one of the input field, it doesn't work but when we provide values for all 4 search fields, it starts working. 

    We have used reset as empty as well.

                      "source": "$source.filterCriterion",
                      "reset": "empty",
                      "auto": "always"

    Could you please advise, how this can be resolved?

    Thanks

    Best Comment

    NG NG

    Thanks - the issue was with handling of NULL values. 

    It got solved by using solution mentioned under https://cloudcustomerconnect.oracle.com/posts/276a0557d3.

    But there is 1 more problem, when I am changing the value in fields after getting Search results. It is not reflecting the correct data, it still refers to the value of previous Search. 

    Please advise how this can be fixed.

    Comment

     

    • John Ceccarelli

      Need more details. Generally you want to create a page variable called filterCriteria of type object with fields for each of the search fields and bind those to the search fields in your form. Then add a custom page function that looks like this:

        PageModule.prototype.getQueryCriteria = function(filterObject) {
          var filterProps = Object.keys(filterObject);
          var criteria = [];
          filterProps.forEach(key => {
            var value = filterObject[key];
            if (value !== undefined && value !== null && value !== '') {
              criteria.push({
                attribute : key,
                op : "$co",
                value : value
              });
            }
          });
          return {criteria: criteria};
        };

      Then add a Search button and in the ojAction event add an assign variable action that assigns the filterCriterion on the SDP to $page.functions.getQueryCriteria($page.variables.filterCriteria)

    • David Konecny

      Also check your Network Monitor and have a look at what query params are being passed into your REST call when 4 search fields are empty - mostly likely the call returns nothing because it is trying to look up records where all these 4 fields having empty value. In which case you need to do for example what John suggested and ignore filter criteria which are not set in the UI.

      -David

    • NG NG

      Thanks - the issue was with handling of NULL values. 

      It got solved by using solution mentioned under https://cloudcustomerconnect.oracle.com/posts/276a0557d3.

      But there is 1 more problem, when I am changing the value in fields after getting Search results. It is not reflecting the correct data, it still refers to the value of previous Search. 

      Please advise how this can be fixed.

    • NG NG

      Hi,

      We have an issue where - when we click on Search button without changing any input criterion, it is not submitting the form.

      There are instances where the data coming from BO/REST API has changed within seconds and user wants to search with same criterion again.

      Please advise how to achieve this.

      Thanks