Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Computed field in a datawindow

103 views
Skip to first unread message

Dale Fox

unread,
Nov 17, 1998, 3:00:00 AM11/17/98
to
>How do I make a computed field in a datawindow editable?
You don't.

If you need for the user to be able to edit a non-DataBase field, then add a
garbage column to the DataWindow. The user will be able to type in there,
but the value won't be saved to the DBMS.

To add a column, hit the SQL button, then choose "Convert to Syntax" (I
believe off the Design menu). Add columns as appropriate. The following
example assumes MSS.
Select table.name,
table.id,
"this will be a string column",
123456780, // This will be an extra numeric column
Convert(DateTime, "1998/01/01") // This will be an extra DateTime
Column

To fake out the "computed field" portion, you can put your calculation code
in the ItemChanged event so that your new columns are set as appropriate.


Dale Fox, CPD

Shobana Juliana wrote in message <#OtqKMjE#GA....@forums.powersoft.com>...
>
>

Mahendra Dhamdhere

unread,
Nov 17, 1998, 3:00:00 AM11/17/98
to
You can't. But you can create computed column. It has a tab order. Go to
SQL painter of datawindow, go to computed, place 0 for number type of
editable column, '' for string type of editable column

--
Mahendra Dhamdhere, CPDA
Email:nospam_m...@hotmail.com
Pl. Remove nospam_ from email id

Sudhir Rao

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
S. Juliana

It cannot be called a computed-field if it is editable. I do not know your requirement. But maybe using a computed-column may help.

S Rao

dm

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
Cngratulations Mr. Fox. You just allowed somebody to break the spine of
encapsulation.
Dale Fox wrote in message <0CGVJTjE#GA....@forums.powersoft.com>...

>>How do I make a computed field in a datawindow editable?

Dale Fox

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
I could swear that you were being a smart-butt, but as you used the term
"encapsulation" incorrectly, that can't be it.
Try looking up the definition of a word before using it eh? Encapsulation
means that a programming object hides the inner workings of it's
functions/services and variables, and is sometimes also called "data
hiding". Unless you're using global functions, DW's are self-contained, and
thus are encapsulated by nature.

I would have agreed if you had said that my suggestion removes DBMS
platform-independence though...

Dale Fox, CPD

dm wrote in message ...

dm

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
Hello Dear Mr. Fox,
Somebody else, not the recipient of your post, used your answer to pass
datawindow values , without using accessors. I am humbly sorry for the
inconvenience of not pointing out the whole situation but I hope that now it
is clarified. Actually my point is that I read many advices from
knowledgeable people like you which answer to questions like:"I have a
datawindow and I don't like its behaviour, how can I break it ?"
BTW, encapsulation also means hiding the values of the attributes of an
object if I remember correctly(It's true that I have a lousy memory)

DM

Dale Fox wrote in message ...

Dale Fox

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
>used your answer to pass
>datawindow values , without using accessors.
I don't know what you mean by 'accessors'; hopefully you've solved the
problem.

>Actually my point is that I read many advices from
>knowledgeable people like you which answer to questions like:"I have a
>datawindow and I don't like its behaviour, how can I break it ?"

Programmers never try to use a tool differently than they are supposed to do
they? :) I've seen a number of those types of questions too...

>BTW, encapsulation also means hiding the values of the attributes

You're right.


Dale Fox, CPD


dm

unread,
Nov 18, 1998, 3:00:00 AM11/18/98
to
My point is: why answer? because sooner or later you'll be forced to
maintain something like this:-(
On the other hand I have to admit that it sounds so egotistical that I
retract everything I wrote. I didn't do it.
Dorin Mera
dm...@shlrmoc.com

Dale Fox wrote in message ...

Simon Caldwell

unread,
Nov 19, 1998, 3:00:00 AM11/19/98
to

dm wrote in message ...
<snip>

>BTW, encapsulation also means hiding the values of the attributes of an
>object if I remember correctly(It's true that I have a lousy memory)
>
But this isn't strictly possible with a datawindow, is it? You need to
refer to the column names in order to manipulate them. So if the name of a
dw column changes, any window that uses it needs to be changed also.
Unless you use column numbers, which makes for unreadable code.

Just my 2d

Simon


dm

unread,
Nov 19, 1998, 3:00:00 AM11/19/98
to
Simon,
It is absolutely true what you wrote. And the datawindow is such a strange
object that Rational in their Rational Rose for Powerbuilder didn't
categorize it(at least in ver 3.0). A datawindow also couples your logic to
the GUI, probably that's why we have datastores now. Dale has a point by
using strictly the definition of hiding the guts of class. On the other
hand, I read lately some discussions about encapsulation where this is
viewed as a quality of preserving the expected functionality of a class. A
datawindow presents real(external) data. If you introduce a fake column you
introduce nonreal data and I know that it is painful to maintain such a
code.
IMHO the first principle of OO is the principle of minimal
astonishment(quoting Grady Booch). So if you deliberately restrict yourself
to the expected behavior of a datawindow you produce more maintainable code.
Dorin Mera

Simon Caldwell wrote in message ...

0 new messages