1

What are some good examples of different ways to handle zero result search answer sets in result views?

Here's what I have right now. I assume I want to do size(this) < 1 but before I plunge ahead I want some ideas about what to do. For example, should I just say "search again" or should I try to recommend something to do?

render {
    if (size(this) > 1) {
      list-of (this) {
        //default-sort-order {
         // sorting(this.title)
       // }
        has-details (true)
        where-each (item) {
          layout-macro (content-thumbnail-card) {
            param (content) {
              expression (item)
            }
          }
        }
      }
    } else-if (size(this) == 1) {
      layout-match (this) {
        mode (Details)
      }
    }
  }
Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29

1 Answers1

3

There is a NoResult dialog that will automatically activate for this condition:

https://bixbydevelopers.com/dev/docs/reference/ref-topics/dialog-modes.dialog-events#no-result-event

You can also place a conditional in your result view. For example:

result-view {

match: SomeConcept(this) 

message {

    if (size(this) == 0) {
        template (No results)
    }
  }

  render {

    layout {
      section {
        content {

        // No Result
        if (size(this)== 0) {
               paragraph(Sorry, I didn't find anything)
         }

    }
   }
  }
 }
}
Pete Haas
  • 1,800
  • 1
  • 12
  • 15