[dabo-users] Backend default field values

2010-01-20 Thread Jacek Kałucki
Hi,

I see that Dabo has ability to retrieve fields set to their
default values on backend.
Unfortunately this feature is mutually exclusive with another feature.
If I set DefaultVales property there is no retrieving any more,
but I would like to use both features simultaneously.
I found two options till now:
- set DefaultValues=None and move settings to OnNew() method
- requery bizobj every new record save.
Don't you think that they should be independent each other?
Maybe there should be a NullDefaults tuple property instead?

-- 
Regards
Jacek Kałucki

___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4b56e9e8.5090...@rz.onet.pl


Re: [dabo-users] Backend default field values

2010-01-20 Thread Ed Leafe
On Jan 20, 2010, at 6:32 AM, Jacek Kałucki wrote:

 I see that Dabo has ability to retrieve fields set to their
 default values on backend.

I don't know what you are referring to. We retrieve the contents of 
records from the database, no matter how they are set.

 Unfortunately this feature is mutually exclusive with another feature.
 If I set DefaultVales property there is no retrieving any more,
 but I would like to use both features simultaneously.
 I found two options till now:
 - set DefaultValues=None and move settings to OnNew() method
 - requery bizobj every new record save.
 Don't you think that they should be independent each other?
 Maybe there should be a NullDefaults tuple property instead?


I am not understanding what you are trying to accomplish. You'll need 
to explain better, perhaps with an example.


-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/2b0eb737-c9f4-43ca-97c3-046886b0f...@leafe.com


Re: [dabo-users] Backend default field values

2010-01-20 Thread Jacek Kałucki
Użytkownik Ed Leafe napisał:
 On Jan 20, 2010, at 6:32 AM, Jacek Kałucki wrote:


 I see that Dabo has ability to retrieve fields set to their
 default values on backend.
  
   I don't know what you are referring to. We retrieve the contents of 
 records from the database, no matter how they are set.


 Unfortunately this feature is mutually exclusive with another feature.
 If I set DefaultVales property there is no retrieving any more,
 but I would like to use both features simultaneously.
 I found two options till now:
 - set DefaultValues=None and move settings to OnNew() method
 - requery bizobj every new record save.
 Don't you think that they should be independent each other?
 Maybe there should be a NullDefaults tuple property instead?
  

   I am not understanding what you are trying to accomplish. You'll need 
 to explain better, perhaps with an example.


Look at dCursorMixin.__saverow() method.
There is code:
code
 if newrec and self._nullDefaults:
 # We need to retrieve any new default values
 aux = self.AuxCursor
 if not isinstance(self.KeyField, tuple):
 keyFIelds = [self.KeyField]
 else:
 keyFIelds = self.KeyField
 wheres = []
 for kf in keyFIelds:
 fld = self.BackendObject.encloseNames(kf, 
self.AutoQuoteNames)
 val = self.getFieldVal(kf)
 if isinstance(val, basestring):
 val = ' + val.encode(self.Encoding) + ' 
 elif isinstance(val, (datetime.date, 
datetime.datetime)):
 val = self.formatDateTime(val)
 else:
 val = str(val)
 wheres.append(%s = %s % (fld, val))
 where =  and .join(wheres)
 aux.execute(select * from %s where %s % (self.Table, 
where))
 try:
 data = aux.getDataSet()[0]
 for fld, val in data.items():
 try:
 self.setFieldVal(fld, val)
 except dException.FieldNotFoundException:
 # Field is not in the dataset
 pass
 except IndexError:
 # For some reason we could not retrieve the 
matching PK record
 pass
/code

Above code retrieve field values of new saved record from backend,
in case they were set by backend.
But it only works when self._nullDefaults equals True (default False).
This attribute is set in setDefaults() method but method is never
executed for non empty defaults.
As you see in setDefaults() method code, _nullDefaults equals True
only if DefaultValues bizobj property equals None,
it's mean that all fields are initialized to None value.
In other words, I can't mix default field values from framework and backend.
I can't choose that field_1 is set to default on backend and
field_2 in framework.

-- 
Regards
Jacek Kałucki

___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4b570bec.1090...@rz.onet.pl


Re: [dabo-users] Backend default field values

2010-01-20 Thread Ed Leafe
On Jan 20, 2010, at 8:58 AM, Jacek Kałucki wrote:

 Above code retrieve field values of new saved record from backend,
 in case they were set by backend.
 But it only works when self._nullDefaults equals True (default False).
 This attribute is set in setDefaults() method but method is never
 executed for non empty defaults.
 As you see in setDefaults() method code, _nullDefaults equals True
 only if DefaultValues bizobj property equals None,
 it's mean that all fields are initialized to None value.

So am I correct that you want to have default values set in both the 
bizobj *and* in the database? If so, am I the only one who thinks that this is 
a very brittle design?

The reason the check is there is to avoid unnecessary traffic to the 
database. IOW, if your bizobj has already handled the default values, there is 
no need to call the database for each new record a second time. But it sounds 
to me like you want the bizobj to only handle some of the logic, and let the 
database handle the rest?


-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/db268937-e08d-4397-8a8f-cb2442093...@leafe.com


Re: [dabo-users] Backend default field values

2010-01-20 Thread Jacek Kałucki
Użytkownik Ed Leafe napisał:
   So am I correct that you want to have default values set in both the 
 bizobj *and* in the database? If so, am I the only one who thinks that this 
 is a very brittle design?

   The reason the check is there is to avoid unnecessary traffic to the 
 database. IOW, if your bizobj has already handled the default values, there 
 is no need to call the database for each new record a second time. But it 
 sounds to me like you want the bizobj to only handle some of the logic, and 
 let the database handle the rest?


Almost all fields are set to default in framework: dates, amounts, etc.
But there are (usually no more than one per table) fields that are very 
important.
They are document reference symbols, which are very specific fields.
Since documents are restricted, these fields:
- must be unique
- numeration must be continuous without missing values
- can't be changed or removed.
Now it's done in single stage operation/transaction on backend.
I can split this process and save record and then get reference
from backend as stored procedure and update table but
risk of failure increases.
And there must be nested transaction involved.
Now I'm still researching how to resolve this safely.

-- 
Regards
Jacek Kałucki

___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4b5723b5.6090...@rz.onet.pl


[dabo-users] cdxml vs. coding

2010-01-20 Thread Jeff Johnson
I have heard some folks saying that they code their own forms.  After 
working with the class designer I feel that it is even better than VFP. 
  I can put together a great form in a short period of time and the 
property sheet, object view, code editor are better than VFP by a long 
shot (in my opinion of course - I've only been working with FoxPro since 
91).  The sizers make for a very professional form, too.  I would like 
to know why some of you code your own forms by hand.

Just a question.

TIA

-- 
Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4b57b37a.40...@dcsoftware.com


Re: [dabo-users] cdxml vs. coding

2010-01-20 Thread Ed Leafe
On Jan 20, 2010, at 8:52 PM, Jeff Johnson wrote:

 I have heard some folks saying that they code their own forms.  After 
 working with the class designer I feel that it is even better than VFP. 
  I can put together a great form in a short period of time and the 
 property sheet, object view, code editor are better than VFP by a long 
 shot (in my opinion of course - I've only been working with FoxPro since 
 91).  The sizers make for a very professional form, too.  I would like 
 to know why some of you code your own forms by hand.

Dabo had been around for several years before I got the Class Designer 
to the point where it was reliable enough for real production use. In the 
meantime, coding your UIs by hand was the only option, and thanks to Python's 
ability to quickly run your code, is almost as fast to do in the hands of a 
good coder. 

I still remember in the Fox 2.x days that there were devs who shunned 
the whole .scx stuff, and coded all their forms in PRGs. It was simply that 
that's the way they learned to do it, and they got very good at it, so they saw 
no reason to change.


-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/24fb6dc8-695b-49c0-b270-7af915767...@leafe.com


Re: [dabo-users] cdxml vs. coding

2010-01-20 Thread Jeff Johnson
Ed Leafe wrote:
 On Jan 20, 2010, at 8:52 PM, Jeff Johnson wrote:
 
 I have heard some folks saying that they code their own forms.  After 
 working with the class designer I feel that it is even better than VFP. 
  I can put together a great form in a short period of time and the 
 property sheet, object view, code editor are better than VFP by a long 
 shot (in my opinion of course - I've only been working with FoxPro since 
 91).  The sizers make for a very professional form, too.  I would like 
 to know why some of you code your own forms by hand.
 
   Dabo had been around for several years before I got the Class Designer 
 to the point where it was reliable enough for real production use. In the 
 meantime, coding your UIs by hand was the only option, and thanks to Python's 
 ability to quickly run your code, is almost as fast to do in the hands of a 
 good coder. 
 
   I still remember in the Fox 2.x days that there were devs who shunned 
 the whole .scx stuff, and coded all their forms in PRGs. It was simply that 
 that's the way they learned to do it, and they got very good at it, so they 
 saw no reason to change.
 
 
 -- Ed Leafe
 

Ed:  I was one of those guys.  Maybe that's why I asked the question.  I 
am totally impressed with the job you guys have done.  The class 
designer is a powerful, reliable and intuitive tool to use.  We won't 
even mention Python here!!!  I am about to launch a major application 
using Dabo and I feel confident I can use Dabo instead of VFP with 
equivalent results.  I can use VFP9 for familiarity, but I want to use Dabo.

Thank you for your dedication to this great project!

Jeff

Jeff Johnson
j...@dcsoftware.com
Phoenix Python User Group - sunpigg...@googlegroups.com
___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4b57ca0d.1070...@dcsoftware.com


Re: [dabo-users] cdxml vs. coding

2010-01-20 Thread John
On Wednesday 20 January 2010 05:52:58 pm Jeff Johnson wrote:
 I have heard some folks saying that they code their own forms.  After
 working with the class designer I feel that it is even better than VFP.
   I can put together a great form in a short period of time and the
 property sheet, object view, code editor are better than VFP by a long
 shot (in my opinion of course - I've only been working with FoxPro since
 91).  The sizers make for a very professional form, too.  I would like
 to know why some of you code your own forms by hand.

 Just a question.

 TIA

Today there is not much of a reason to hand code a form.  That said, I still 
hand code my forms.  I find that it offers flexibility that the ClassDesigner 
does not.

Johnf
___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/201001201926.16475.jo...@jfcomputer.com


Re: [dabo-users] cdxml vs. coding

2010-01-20 Thread Nate Lowrie
On Wed, Jan 20, 2010 at 22:29, Jeff Johnson j...@dcsoftware.com wrote:

 Ed:  I was one of those guys.  Maybe that's why I asked the question.  I
 am totally impressed with the job you guys have done.  The class
 designer is a powerful, reliable and intuitive tool to use.  We won't
 even mention Python here!!!  I am about to launch a major application
 using Dabo and I feel confident I can use Dabo instead of VFP with
 equivalent results.  I can use VFP9 for familiarity, but I want to use
 Dabo.


Jeff,

Its funny that you mention reliability because it's the reason why I do not
use the ClassDesigner.  I have run into issues and while it has gotten so
much better since I started using Dabo, I find I can hand code a form just
as fast on a reliable text editor.  I have lost changes and had trouble
making changes to the designer code more times than I care to count.  Maybe
this is because I use a large set of custom controls, many with dynamic
display properties.

Either way, I use all of the other xml standards dabo has (connection, menu,
and report), just not the class designer.  Ed has done a tremendous amount
of work to it and I like what I see so far, it's just not there enough for
my liking.

Regards,

Nate


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/4bef56241001201958l1250a3f6j21e66d413edab...@mail.gmail.com