Hi Sumit,
Yes it returns 1 item but its in GenericEntity
([[GenericEntity:OrderAndTaxByCounty][OTCMOrderSubTotal,
104.85(java.lang.Double)]]) format. I am not sure how to directly refer/get
my desired value.
Let me know if you have any idea.
Thank you.
Su-
Sumit Pandit-3 wrote:
>
> Hi Su,
>
> Look at the "findByCondition" method, it returns a list, if you are
> sure that this list contains only one item then you can get it from
> orderAndTaxByCounty = subTotalObject.get(0) and then
> return( orderAndTaxByCounty.get("OTCMOrderSubTotal")) would work for
> you.
>
> --
> Regards
> Sumit Pandit
>
> On 30-Sep-09, at 8:33 AM, su2 wrote:
>
>>
>> Hello Friends,
>>
>> I have created following java function with delegator.
>>
>> ----------------------------------------------------------------------------
>> public static String getOrderSubTotal(GenericDelegator delegator,
>> String
>> OTCMOrderNo) {
>> List subTotalObject = null;
>>
>>
>> try {
>>
>> List fieldsToSelect =
>> UtilMisc.toList("OTCMOrderSubTotal");
>>
>> EntityConditionList whereConditions = new
>> EntityConditionList(UtilMisc.toList(
>> new EntityExpr("OTCMOrderNo",
>> EntityOperator.EQUALS,
>> OTCMOrderNo),
>> new EntityExpr("OTCMAdjustmentAmountType",
>> EntityOperator.EQUALS, "SHIPPING_CHARGES"),
>> new EntityExpr("OTCMContactType",
>> EntityOperator.EQUALS,
>> "SHIPPING_LOCATION")
>> ), EntityOperator.AND);
>>
>> subTotalObject =
>> delegator.findByCondition("OrderAndTaxByCounty",
>> whereConditions, null, fieldsToSelect, null, null);
>>
>>
>> } catch (GenericEntityException e) {
>> Debug.logError(e, "Error finding OrderAndTaxByCounty in
>> getPartyName", module);
>> }
>>
>> String subTotal = String.valueOf(subTotalObject);
>>
>> return subTotal;
>>
>> }
>> -------------------------------------------------------------------------------------
>>
>> I am trying to call this java function in Form widget with
>>
>> <display
>> description="$
>> {bsh:com
>> .opensourcestrategies
>> .financials.reports.ReportHelper.getOrderSubTotal(delegator,
>> OTCMOrderNo)}"/>
>>
>> The "return Subtotal" in my java class prints
>>
>> -------------------------------------------------------------------------------------
>> [[GenericEntity:OrderAndTaxByCounty][OTCMOrderSubTotal,
>> 104.85(java.lang.Double)]]
>> -------------------------------------------------------------------------------------
>> I need to just print 104.85. Is there anyway to just get that part ?
>> As you
>> can see it is printing lot of extra stuff.
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-get-value-from-the-delegator-object-declared-as-list-which-has-only-one-value--tp25674270p25674270.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
--
View this message in context:
http://www.nabble.com/How-to-get-value-from-the-delegator-object-declared-as-list-which-has-only-one-value--tp25674270p25680369.html
Sent from the OFBiz - User mailing list archive at Nabble.com.