Re: query condition in Subtract 2 timestamps

Posted by David E Jones-2 on
URL: http://ofbiz.116.s1.nabble.com/query-condition-in-Subtract-2-timestamps-tp141298p141302.html


So, is this working for you, or what error are you getting? Leaving  
the attribute blank should be okay, though I don't know that I've  
tested it...

-David


On Aug 9, 2006, at 3:12 PM, Mamdouh Kaadan wrote:

> Dear David
>
>
>
> Thank you for your fast response, I tried to use complex alias, but  
> the
> problem is that the first date is from one table and the other date is
> from another table, and entity-alias attribute is required in alias
> node,
>
> I tried the following:
>
>   <view-entity entity-name="IndicatorIssueAndIssueItem"
> package-name="org.ofbiz.crm.crm" title="">
>
>       <member-entity entity-alias="ISS" entity-name="Issue"/>
>
>       <member-entity entity-alias="ISSI" entity-name="IssueItem"/>
>
>
>
>
>
>
>       <alias entity-alias="ISS" name="issueId"/>
>
>       <alias entity-alias="ISS" name="departmentId"/>
>
>       <alias entity-alias="ISS" name="callingNumber"/>
>
>       <alias entity-alias="ISS" name="dateTimeStarted"/>
>
>       <alias entity-alias="ISS" name="partyId"/>
>
>       <alias entity-alias="ISSI" name="issueItemId"/>
>
>       <alias entity-alias="ISSI" name="caseId"/>
>
>       <alias entity-alias="ISSI" name="specId"/>
>
>       <alias entity-alias="ISSI" name="statusId"/>
>
>       <alias entity-alias="ISSI" name="otherNumbers"/>
>
>       <alias entity-alias="ISSI" name="urgent"/>
>
>       <alias entity-alias="ISSI" name="currentDeptId"/>
>
>       <alias entity-alias="ISSI" name="additionalRemark"/>
>
>       <alias entity-alias="ISSI" name="lineTypeId"/>
>
> <alias entity-alias="ISSI" name=" firstActionDate"/>
>
> <alias entity-alias="ISSI" name=" SolvedDate"/>
>
>
>
>         <alias entity-alias="" name="firstActionDifference">
>
>               <complex-alias operator="-">
>
>                   <complex-alias-field entity-alias="ISSI"
> field="firstActionDate"/>
>
>                   <complex-alias-field entity-alias="ISS"
> field="dateTimeStarted"/>
>
>               </complex-alias>
>
>         </alias>
>
>         <alias entity-alias="" name="SolvedDifference">
>
>               <complex-alias operator="-">
>
>                   <complex-alias-field entity-alias="ISSI"
> field="SolvedDate"/>
>
>                   <complex-alias-field entity-alias="ISS"
> field="dateTimeStarted"/>
>
>               </complex-alias>
>
>         </alias>
>
>       <view-link entity-alias="ISS" rel-entity-alias="ISSI">
>
>         <key-map field-name="issueId"/>
>
>       </view-link>
>
>     </view-entity>
>
>
>
> Can you help me please, thanks
>
>
>
> ==================================
>
> Mamdouh Kaadan
>
>
>
>
>
> -----Original Message-----
> From: David E. Jones [mailto:[hidden email]]
> Sent: Wednesday, August 09, 2006 6:55 PM
> To: [hidden email]
> Subject: Re: query condition in Subtract 2 timestamps
>
>
>
>
>
> Use a view-entity with a complex-alias field (either in an XML view-
>
> entity definition, or in a DynamicViewEntity).
>
>
>
> For details about how to do stuff like this you might find the
>
> recently completed advanced framework training package from Undersun
>
> helpful. There are details here:
>
>
>
> http://www.undersunconsulting.com/ecommerce/control/product/
>
> ~category_id=USC_PROMO/~product_id=OFBADVFWKPKG
>
>
>
> -David
>
>
>
>
>
> On Aug 9, 2006, at 11:43 AM, Mamdouh Kaadan wrote:
>
>
>
>> Dear all
>
>>
>
>>
>
>>
>
>> How can I make SQL query in OFBiz based on subtract 2 timestamps,
>
>>
>
>> By example:
>
>>
>
>> select * from table
>
>>
>
>> where FIRST_ACTION_DATE- Second_ACTION_DATE <'+00 12:00:00.000000'
>
>>
>
>>
>
>>
>
>> How can I make the previous statement using the delegator methods??
>
>>
>
>>
>
>>
>
>> Thanks in advance
>
>>
>
>> ==================================
>
>>
>
>> Mamdouh Kaadan
>
>>
>
>> Software Engineer
>
>>
>
>> IT - Application
>
>>
>
>> Areeba SYRIA
>
>>
>
>> Mobile: +963-94-222763
>
>>
>
>> Office :  +963-94-222222   Ext: 2288
>
>>
>
>> E-mail:[hidden email]
>
>>
>
>>
>
>>
>
>>
>
>>
>
>
>