display_with
Definition
When you ask a question involving a class, sometimes you will want to see additional information to it by default.
Example: When you ask 'show me all orders in the last 2 weeks', you may want to see the customer name that ordered it, the total amount, etc.
By default, Veezoo will choose automatically what it believes is the most relevant information that should be shown together with it.
However, you may define what you want Veezoo to always display by using the display_with
property.
Usage
The display_with
property takes an array of attributes and relationships that you want displayed by default.
import: [
db.postgres.movie_db.public.ORDERS
]
kb {
class Order {
name.en: "Order"
sql: "${ORDERS.id}"
display_with: [
with_Customer,
Total_Amount,
Order_Date
]
...
}
}
In the case above, whenever you ask about orders, Veezoo will show you a table with the Order ID (see sql
of Orders) followed by the Customer, the total amount and the order date.
If you don't want to see the Order ID, you can hide it by adding the tag KB_ShowOnlyRepresenters
.
import: [
db.postgres.movie_db.public.ORDERS
]
kb {
class Order {
name.en: "Order"
// Add this when the class itself shouldn't be shown in the table
// only the ones from display_with
// Useful when there is no `sql` defined
tag: KB_ShowOnlyRepresenters
sql: "${ORDERS.id}"
display_with: [
with_Customer,
Total_Amount,
Order_Date
]
...
}
}