On 2/1/12 11:12 AM, MB Software Solutions, LLC wrote:
> On 2/1/2012 1:20 PM, Frank Cazabon wrote:
>> yes, it does make development easier, but I still do find instances
>> where I would use SQL in the UI for display purposes, but maybe I should
>> be trying to avoid that more.
>>
>
> No, I think the example you gave with updating the invoice total as
> items are added in the UI is fine there. In my form, I'd have a simple
> routine that calculated the total/sum and updated the textbox that
> reflected that total:
>
> thisform.CalcTotal()
>
> in thisform.CalcTotal method:
> select sum(paidamt) from (this.grdPayments.RecordSource) into array laSum
> this.txtTotalPaid.value = nvl(laSum(1),0)
In Dabo (sorry), we have VirtualFields as a concept of the bizobj. The flow in
this
case would be:
self.Form.update() ## ask the bizobj for the current values for all the
controls
That call results, among other things, in the virtual field function for the
'paidamt' field being called, which would have code like:
class MyBiz(dabo.biz.dBizobj):
def initProperties(self):
self.VirtualFields["paidamt"] = getPaidAmt ## map field name to function
def getPaidAmt(self):
sql = "select sum(paidamt) as amt from %s" % self.DataSource
cur = self.getTempCursor(sql)
return cur.Record.amt
Keeping the UI code-minimal with regards to data is a good thing to strive for.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.