View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

Selector Example

Contents

Introduction

The Business Partner selector is one of the most used selectors in the application. It allows the user pick a Customer, Vendor, etc in the the application. It composed by a drop-down list (picklist) where you can type to search, and a popup grid when you click the magnifier icon.

Ob3-example-reference0.png


Ob3-example-reference0b.png

Objective

The main objective is to explain all the configuration settings made in the Business Partner selector. The current version of the selector is implemented as SmartClient FormItem and is using a Custom Query selector definition.

Application Dictionary definition

Reference

User Interface Definition

Ob3-example-reference1.png

Defined Selector

SELECT distinct bp.name as name,bp.id as bpid, bp.searchKey as value,
   bp.creditLimit - bp.creditUsed as creditAvailable, bp.creditUsed as creditUsed,
   COALESCE(contact.name, usercontact.name) as contactname, COALESCE(contact.id, usercontact.id) as contactid,
   bploc.name as locationname, bploc.id as locationid,
   bp.customer as customer, bp.vendor as vendor, bp.lifetimeRevenueToDate as income
FROM BusinessPartner bp left join bp.businessPartnerLocationList bploc
                        left join bploc.locationAddress loc
                        left join bploc.aDUserList contact
                        left join loc.region region
                        left join bp.aDUserList usercontact with usercontact.partnerAddress.id is null
where @additional_filters@
  and bp.summaryLevel = false

The Business Partner selector also shows the contacts and locations. The hql is joining with the associated entities. Notice in the where clause you have a constant @additional_filters@.

The @additional_filters@ appends automatically the implicit filter by Client and accessible Organizations. Notice that the client and organization filter is applied to the base table in the hql query. For eg., in the above query, the filters will be applied on the BusinessPartner bp table. Also, when filtering by an specific field in the popup grid, the Left Where Clause is appended in this location. See Defined Selector Field

Ob3-example-reference2.png

Defined Selector Field

Bulbgraph.png   This is just one of the several fields defined for this selector
COALESCE(contact.name, usercontact.name)

This part is the left side of the expression when filtering using this field. This expression is transformed in COALESCE(contact.name, usercontact.name) like 'value' where value is the text entered by the user in the popup grid. The like operator is based on the text matching style.

Ob3-example-reference3.png

Retrieved from "http://wiki.openbravo.com/wiki/Selector_Example"

This page has been accessed 9,085 times. This page was last modified on 4 August 2014, at 07:06. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.