ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trà Đá Một Mình <nguyenthang0...@gmail.com>
Subject Re: How to set default value for LEFT JOIN
Date Sat, 29 Jul 2017 03:15:18 GMT
Thanks Sakke,
But I want to mention to view-entity on ofbiz framework.
Ex:
<view-entity entity-name="ReturnHeaderAndParty"
package-name="org.ofbiz.party.party">
<member-entity entity-alias="PG" entity-name="PartyGroup"></member-entity>
<member-entity entity-alias="RH" entity-name="ReturnHeader"></member-entity>
<alias-all entity-alias="RH"></alias-all>
<alias-all entity-alias="PG"></alias-all>
<view-link rel-entity-alias="PG" entity-alias="RH" rel-optional="true">
<key-map field-name="toPartyId" rel-field-name="partyId" />
</view-link>
</view-entity>

We using: rel-optional="true" to define LEFT JOIN but I don't know how to
set default value for field empty (null) in this view.


On Sat, Jul 29, 2017 at 3:44 AM, Sakke Ferraris <sakke@ferrasys.com> wrote:

> Hi,
>
> If I understand your question correctly It can be done in exactly the same
> way as when you run the SQL.
> In the view you specify a SELECT statement in which you can use
> case/ISNULL etc.
>
> CREATE VIEW view_name AS
> SELECT table_right.column1
>         IFNULL(table_left.column2, 0),
>         Table_right.column3,
>          etc...
> FROM table_name1 As table_right
> Left outer join table_name2 As table_left
> ON table_right.column1 = table_left.column1
> WHERE condition;
>
> BR, Sakke Ferraris
>
> -----Ursprungligt meddelande-----
> Från: Trà Đá Một Mình [mailto:nguyenthang0905@gmail.com]
> Skickat: den 26 juli 2017 08:51
> Till: dev@ofbiz.apache.org
> Ämne: How to set default value for LEFT JOIN
>
> Hi Everyone,
>
> In SQL, we can using case-when, ISNULL or another way to set default value
> for a column if returned NULL. So how we can do this with view-entity ?
>
> Thanks!
>
> --
> *THANG NGUYEN (Mr)*
>
> *OLBIUS DEVELOPER**Email:* nguyenthang0905@gmail.com| *Mobile:* (+84)
> 1674636641
>
> *OLBIUS., JSC*
> *Tel:* (+84) 9 88 99 3333
> *Address: *25th Fl., No 91, Nguyen Chi Thanh St., Ha Noi City, VietNam
> *Website:* http://olbius.com
>



-- 
*THANG NGUYEN (Mr)*

*OLBIUS DEVELOPER**Email:* nguyenthang0905@gmail.com| *Mobile:* (+84) 96
955 0905

*OLBIUS., JSC*
*Tel:* (+84) 9 88 99 3333
*Address: *25th Fl., No 91, Nguyen Chi Thanh St., Ha Noi City, VietNam
*Website:* http://olbius.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message