View-entity with WHERE clause

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
su2
Reply | Threaded
Open this post in threaded view
|

View-entity with WHERE clause

su2
Hello Friends, I would like to create a view entity for entity "orderheader" and "orderContactMech". I want to have that to represent following SQL.
---------------------------------------------------------------------------------------------------
SELECT orderheader.orderId, orderheader.orderDate, orderContactMech.contactMechId FROM orderheader OUTER JOIN orderContactMech ON orderheader.orderId = orderContactMech.orderId WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
---------------------------------------------------------------------------------------------------
I have idea how to create view entity without WHERE clause. But not sure how to add WHERE clause.
I appreciate the help.
Thanks in advance.
Su-
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

BJ Freeman
http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
The where is in the find query.
or conditionals in the widgets.

su2 sent the following on 9/22/2009 12:52 PM:

> Hello Friends,
>
> I would like to create a view entity for entity "orderheader" and
> "orderContactMech". I want to have that to represent following SQL.
>
> ---------------------------------------------------------------------------------------------------
> SELECT orderheader.orderId, orderheader.orderDate,
> orderContactMech.contactMechId
> FROM orderheader OUTER JOIN  orderContactMech ON orderheader.orderId =
> orderContactMech.orderId
> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
> ---------------------------------------------------------------------------------------------------
>
> I have idea how to create view entity without WHERE clause. But not sure how
> to add WHERE clause.
>
> I appreciate the help.
>
> Thanks in advance.
>
> Su-
>
>
>
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

su2
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

su2
Sorry I was not able to understand "find query" part. I got the "widget"
part. Where do we specify "find query"?

Thank you for the help.
Su-



BJ Freeman wrote:

> http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
> The where is in the find query.
> or conditionals in the widgets.
>
> su2 sent the following on 9/22/2009 12:52 PM:
>  
>> Hello Friends,
>>
>> I would like to create a view entity for entity "orderheader" and
>> "orderContactMech". I want to have that to represent following SQL.
>>
>> ---------------------------------------------------------------------------------------------------
>> SELECT orderheader.orderId, orderheader.orderDate,
>> orderContactMech.contactMechId
>> FROM orderheader OUTER JOIN  orderContactMech ON orderheader.orderId =
>> orderContactMech.orderId
>> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
>> ---------------------------------------------------------------------------------------------------
>>
>> I have idea how to create view entity without WHERE clause. But not sure how
>> to add WHERE clause.
>>
>> I appreciate the help.
>>
>> Thanks in advance.
>>
>> Su-
>>
>>
>>
>>
>>    
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

BJ Freeman
In reply to this post by BJ Freeman
it is in the same document I gave a link to
under Finding
please read the whole document.

Shuchi Mehta sent the following on 9/22/2009 1:32 PM:

> Sorry I was not able to understand "find query" part. I got the "widget"
> part. Where do we specify "find query"?
>
> Thank you for the help.
> Su-
>
>
>
> BJ Freeman wrote:
>> http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
>> The where is in the find query.
>> or conditionals in the widgets.
>>
>> su2 sent the following on 9/22/2009 12:52 PM:
>>  
>>> Hello Friends,
>>>
>>> I would like to create a view entity for entity "orderheader" and
>>> "orderContactMech". I want to have that to represent following SQL.
>>>
>>> ---------------------------------------------------------------------------------------------------
>>>
>>> SELECT orderheader.orderId, orderheader.orderDate,
>>> orderContactMech.contactMechId FROM orderheader OUTER JOIN
>>> orderContactMech ON orderheader.orderId =
>>> orderContactMech.orderId
>>> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
>>> ---------------------------------------------------------------------------------------------------
>>>
>>>
>>> I have idea how to create view entity without WHERE clause. But not
>>> sure how
>>> to add WHERE clause.
>>>
>>> I appreciate the help.
>>>
>>> Thanks in advance.
>>>
>>> Su-
>>>
>>>
>>>
>>>
>>>    
>>
>>  
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

su2
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

su2
Thank you. And apologize for being little impatient.

I read the document, and what I understood is Finding (findByAnd) method
is used in .bsh file. So, I just want to make sure that there is no way
to specify "WHERE" clause while creating the <view-entity>. correct?

Again, thanks for your help.
Shuchi-

BJ Freeman wrote:

> it is in the same document I gave a link to
> under Finding
> please read the whole document.
>
> Shuchi Mehta sent the following on 9/22/2009 1:32 PM:
>  
>> Sorry I was not able to understand "find query" part. I got the "widget"
>> part. Where do we specify "find query"?
>>
>> Thank you for the help.
>> Su-
>>
>>
>>
>> BJ Freeman wrote:
>>    
>>> http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
>>> The where is in the find query.
>>> or conditionals in the widgets.
>>>
>>> su2 sent the following on 9/22/2009 12:52 PM:
>>>  
>>>      
>>>> Hello Friends,
>>>>
>>>> I would like to create a view entity for entity "orderheader" and
>>>> "orderContactMech". I want to have that to represent following SQL.
>>>>
>>>> ---------------------------------------------------------------------------------------------------
>>>>
>>>> SELECT orderheader.orderId, orderheader.orderDate,
>>>> orderContactMech.contactMechId FROM orderheader OUTER JOIN
>>>> orderContactMech ON orderheader.orderId =
>>>> orderContactMech.orderId
>>>> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
>>>> ---------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>> I have idea how to create view entity without WHERE clause. But not
>>>> sure how
>>>> to add WHERE clause.
>>>>
>>>> I appreciate the help.
>>>>
>>>> Thanks in advance.
>>>>
>>>> Su-
>>>>
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

BJ Freeman
In reply to this post by BJ Freeman
findby can be used in minilanq, and java, which includes the bsh
\framework\entity\dtd\entitymodel.xsd has all the current capablities.
since your using 4.0 you will have to see since I don't use it any more.

Shuchi Mehta sent the following on 9/22/2009 1:48 PM:

> Thank you. And apologize for being little impatient.
>
> I read the document, and what I understood is Finding (findByAnd) method
> is used in .bsh file. So, I just want to make sure that there is no way
> to specify "WHERE" clause while creating the <view-entity>. correct?
>
> Again, thanks for your help.
> Shuchi-
>
> BJ Freeman wrote:
>> it is in the same document I gave a link to
>> under Finding
>> please read the whole document.
>>
>> Shuchi Mehta sent the following on 9/22/2009 1:32 PM:
>>  
>>> Sorry I was not able to understand "find query" part. I got the "widget"
>>> part. Where do we specify "find query"?
>>>
>>> Thank you for the help.
>>> Su-
>>>
>>>
>>>
>>> BJ Freeman wrote:
>>>    
>>>> http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
>>>> The where is in the find query.
>>>> or conditionals in the widgets.
>>>>
>>>> su2 sent the following on 9/22/2009 12:52 PM:
>>>>  
>>>>      
>>>>> Hello Friends,
>>>>>
>>>>> I would like to create a view entity for entity "orderheader" and
>>>>> "orderContactMech". I want to have that to represent following SQL.
>>>>>
>>>>> ---------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> SELECT orderheader.orderId, orderheader.orderDate,
>>>>> orderContactMech.contactMechId FROM orderheader OUTER JOIN
>>>>> orderContactMech ON orderheader.orderId =
>>>>> orderContactMech.orderId
>>>>> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
>>>>> ---------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> I have idea how to create view entity without WHERE clause. But not
>>>>> sure how
>>>>> to add WHERE clause.
>>>>>
>>>>> I appreciate the help.
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Su-
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>        
>>
>>  
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

Yoke Power
Hi Su,

Just to give a back ground, Entity and View Entity work in the same fashion
at runtime/query execution; the only difference being, entity is used for
single entity and view-entity is used for combining multiple entities; that
being said, entity OR view-entity query has two parts namely

1) Static Part     --> Entity or View-Entity (Joined Tables) -> defined in
the xml i.e. entitymodel.xml
2) Dynamic Part --> Where condition, Having, Order By etc --> Passed at
runtime

If you want to create the view-entity with Where condition using mini lang
use <entity-condition>
if you want to create the view-entity in java call the Generic Delegator's
find method and pass the condition (object) as the second parameter i.e. the
method signature is
public EntityListIterator find(String entityName, EntityCondition
whereEntityCondition,
            EntityCondition havingEntityCondition, Set<String>
fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
            throws GenericEntityException

Example of calling the find method in the Service can be found in
org.ofbiz.accounting.finaccount.FinAccountServices.java

                EntityCondition condition =
EntityCondition.makeCondition(exprs, EntityOperator.AND);
                EntityListIterator eli = null;
                try {
                    eli = delegator.find("FinAccountTrans", condition, null,
null, UtilMisc.toList("-transactionDate"), null);

Let us know if you have questions

- YOKEPOWER


On Tue, Sep 22, 2009 at 6:05 PM, BJ Freeman <[hidden email]> wrote:

> findby can be used in minilanq, and java, which includes the bsh
> \framework\entity\dtd\entitymodel.xsd has all the current capablities.
> since your using 4.0 you will have to see since I don't use it any more.
>
> Shuchi Mehta sent the following on 9/22/2009 1:48 PM:
> > Thank you. And apologize for being little impatient.
> >
> > I read the document, and what I understood is Finding (findByAnd) method
> > is used in .bsh file. So, I just want to make sure that there is no way
> > to specify "WHERE" clause while creating the <view-entity>. correct?
> >
> > Again, thanks for your help.
> > Shuchi-
> >
> > BJ Freeman wrote:
> >> it is in the same document I gave a link to
> >> under Finding
> >> please read the whole document.
> >>
> >> Shuchi Mehta sent the following on 9/22/2009 1:32 PM:
> >>
> >>> Sorry I was not able to understand "find query" part. I got the
> "widget"
> >>> part. Where do we specify "find query"?
> >>>
> >>> Thank you for the help.
> >>> Su-
> >>>
> >>>
> >>>
> >>> BJ Freeman wrote:
> >>>
> >>>> http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling
> >>>> The where is in the find query.
> >>>> or conditionals in the widgets.
> >>>>
> >>>> su2 sent the following on 9/22/2009 12:52 PM:
> >>>>
> >>>>
> >>>>> Hello Friends,
> >>>>>
> >>>>> I would like to create a view entity for entity "orderheader" and
> >>>>> "orderContactMech". I want to have that to represent following SQL.
> >>>>>
> >>>>>
> ---------------------------------------------------------------------------------------------------
> >>>>>
> >>>>>
> >>>>> SELECT orderheader.orderId, orderheader.orderDate,
> >>>>> orderContactMech.contactMechId FROM orderheader OUTER JOIN
> >>>>> orderContactMech ON orderheader.orderId =
> >>>>> orderContactMech.orderId
> >>>>> WHERE orderContactMech.contactMechPurposeTypeId =
> 'SHIPPING_LOCATION'.
> >>>>>
> ---------------------------------------------------------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> I have idea how to create view entity without WHERE clause. But not
> >>>>> sure how
> >>>>> to add WHERE clause.
> >>>>>
> >>>>> I appreciate the help.
> >>>>>
> >>>>> Thanks in advance.
> >>>>>
> >>>>> Su-
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>
> >>
> >
>
> --
> BJ Freeman
> http://www.businessesnetwork.com/automation
> http://bjfreeman.elance.com
>
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> Systems Integrator.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: View-entity with WHERE clause

David E. Jones-2
In reply to this post by su2

In the OFBiz trunk there is an option for view-entity definitions to  
include an entity-condition element that is similar to the ones in  
simple-method and various widgets, and that will allow you to add a  
where condition to the view-entity def.

-David


On Sep 22, 2009, at 1:52 PM, su2 wrote:

>
> Hello Friends,
>
> I would like to create a view entity for entity "orderheader" and
> "orderContactMech". I want to have that to represent following SQL.
>
> ---------------------------------------------------------------------------------------------------
> SELECT orderheader.orderId, orderheader.orderDate,
> orderContactMech.contactMechId
> FROM orderheader OUTER JOIN  orderContactMech ON orderheader.orderId =
> orderContactMech.orderId
> WHERE orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'.
> ---------------------------------------------------------------------------------------------------
>
> I have idea how to create view entity without WHERE clause. But not  
> sure how
> to add WHERE clause.
>
> I appreciate the help.
>
> Thanks in advance.
>
> Su-
>
>
>
>
> --
> View this message in context: http://www.nabble.com/View-entity-with-WHERE-clause-tp25530883p25530883.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.