Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Checkbox in datawindow

4 posts in PowerBuilder Foundation Classes (PFC) Last posting was on 2011-12-13 13:36:00Z
sa Posted on 2011-12-12 06:32:19Z
Sender: 1254.4ee59fb3.1804289383@sybase.com
From: Sa
Newsgroups: sybase.public.powerbuilder.pfc
Subject: Checkbox in datawindow
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ee59ff3.1273.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 11 Dec 2011 22:32:19 -0800
X-Trace: forums-1-dub 1323671539 10.22.241.41 (11 Dec 2011 22:32:19 -0800)
X-Original-Trace: 11 Dec 2011 22:32:19 -0800, 10.22.241.41
Lines: 11
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.pfc:19320
Article PK: 776480

I have a checkbox in the datawindow, It can be checked and
unchecked. The default value in the db is 0. When Its
checked, the db value is updated to 1 and on uncheck the
value is updated to 0 again.
However, I want to update the database only if it has value
0. If it is already 1, then I don't want to change it back
to 0. So please tell me how can I do that?
Here is the code from my datawindow for the checkbox :
Here is the code for that:
column=(type=decimal(0) update=yes updatewhereclause=yes
name=ok dbname="table.ok" values="1/0" )


"Paul Horan[Sybase]" Posted on 2011-12-12 18:00:04Z
From: "Paul Horan[Sybase]" <phoran AT sybase DOT com>
Newsgroups: sybase.public.powerbuilder.pfc
References: <4ee59ff3.1273.1681692777@sybase.com>
Subject: Re: Checkbox in datawindow
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ee64124$1@forums-1-dub>
Date: 12 Dec 2011 10:00:04 -0800
X-Trace: forums-1-dub 1323712804 10.22.241.152 (12 Dec 2011 10:00:04 -0800)
X-Original-Trace: 12 Dec 2011 10:00:04 -0800, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.pfc:19322
Article PK: 747989

So, if the initial retrieve is a 1 (checked), you want to prevent the user
from changing it back to a 0 (unchecking it?).
If you put an expression on the Protect attribute of the checkbox, you can
stop them from unchecking it...

The expression would normally be "if( myCheckbox=1, 1, 0)" but since you're
already guaranteeing a 1 or 0 in the column, you get a nice little
shortcut - just use the column name as the expression!

I'm firmly in the camp of "prevent the user from making the mistake, rather
than letting them make it and cleaning up the mess afterwards..."

--
Paul Horan[Sybase]
http://paulhoran.ulitzer.com

<Sa> wrote in message news:4ee59ff3.1273.1681692777@sybase.com...
>I have a checkbox in the datawindow, It can be checked and
> unchecked. The default value in the db is 0. When Its
> checked, the db value is updated to 1 and on uncheck the
> value is updated to 0 again.
> However, I want to update the database only if it has value
> 0. If it is already 1, then I don't want to change it back
> to 0. So please tell me how can I do that?
> Here is the code from my datawindow for the checkbox :
> Here is the code for that:
> column=(type=decimal(0) update=yes updatewhereclause=yes
> name=ok dbname="table.ok" values="1/0" )


Scott Morris Posted on 2011-12-12 16:29:50Z
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Newsgroups: sybase.public.powerbuilder.pfc
Subject: Re: Checkbox in datawindow
References: <4ee59ff3.1273.1681692777@sybase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: "Scott Morris" <bogus@abc.def>
Message-ID: <op.v6dxfyunq59cbq@scott-win7.divinv.net>
User-Agent: Opera Mail/11.51 (Win32)
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 12 Dec 2011 08:29:50 -0800
X-Trace: forums-1-dub 1323707390 10.22.241.152 (12 Dec 2011 08:29:50 -0800)
X-Original-Trace: 12 Dec 2011 08:29:50 -0800, vip152.sybase.com
Lines: 27
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.pfc:19321
Article PK: 747990


On Mon, 12 Dec 2011 01:32:19 -0500, <Sa> wrote:

> I have a checkbox in the datawindow, It can be checked and
> unchecked. The default value in the db is 0. When Its
> checked, the db value is updated to 1 and on uncheck the
> value is updated to 0 again.
> However, I want to update the database only if it has value
> 0. If it is already 1, then I don't want to change it back
> to 0. So please tell me how can I do that?
> Here is the code from my datawindow for the checkbox :
> Here is the code for that:
> column=(type=decimal(0) update=yes updatewhereclause=yes
> name=ok dbname="table.ok" values="1/0" )

Note for future reference - always identify which version/build of
Powerbuilder you are using.

Your narrative is a bit confusing and a bit sparse, so I'll answer in a
generic sense. There are a number of ways to avoid executing DML
statements generated by a datawindow.
You could intercept them in the sqlpreview event of the
datawindow/datastore. You could reset the itemstatus of the row when the
checkbox is clicked. You could reset the itemstatus for the appropriate
rows when you execute the input-verification logic in your application.
Since you posted in the PFC newsgroup, this corresponds to the
pfc_validation event. Those are the most obvious choices; I'm certain
there are other ways as well.


Chris Pollach Posted on 2011-12-13 13:36:00Z
From: "Chris Pollach" <cpollach@travel-net.com>
Newsgroups: sybase.public.powerbuilder.pfc
References: <4ee59ff3.1273.1681692777@sybase.com>
Subject: Re: Checkbox in datawindow
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ee754c0@forums-1-dub>
Date: 13 Dec 2011 05:36:00 -0800
X-Trace: forums-1-dub 1323783360 10.22.241.152 (13 Dec 2011 05:36:00 -0800)
X-Original-Trace: 13 Dec 2011 05:36:00 -0800, vip152.sybase.com
X-Authenticated-User: pb125beta
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.pfc:19323
Article PK: 747991

Hi;

That does not make sense. Just disable the checkbox if its checked (aka
value =1). Why play around with the SQL - just lock the user out. You can
use a DW Expression to protect the CB.

--
Regards ... Chris
Blog: http://chrispollach.blogspot.com
PBDJ: http://chrispollach.sys-con.com
SourceForge: http://sourceforge.net/projects/stdfndclass

<Sa> wrote in message news:4ee59ff3.1273.1681692777@sybase.com...
>I have a checkbox in the datawindow, It can be checked and
> unchecked. The default value in the db is 0. When Its
> checked, the db value is updated to 1 and on uncheck the
> value is updated to 0 again.
> However, I want to update the database only if it has value
> 0. If it is already 1, then I don't want to change it back
> to 0. So please tell me how can I do that?
> Here is the code from my datawindow for the checkbox :
> Here is the code for that:
> column=(type=decimal(0) update=yes updatewhereclause=yes
> name=ok dbname="table.ok" values="1/0" )