Thanks Bob for the response.

Yes, You are correct, the "delegator.findByCondition" returns a
GenericEntity.

I think subTotalObject.get("OTCMOrderSubTotal") will not help me as .get(int
index) - it takes only int index. That is where I am stuck, as I am not sure
how can I directly reference my desired value. 

It would be helpful if you can share the idea.

Thank you.
Su-


Bob Morley wrote:
> 
> This line will return a GenericEntity, not the single selected field:
> subTotalObject = delegator.findByCondition
> 
> Change the bottom of your method to something like...
> 
> String subTotal = String.valueOf(subTotalObject.get 
> ("OTCMOrderSubTotal"));
> 
> Bob
> 
> On 2009-09-29, at 11:03 PM, su2 <[email protected]> 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--tp25674270p25680328.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to