[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1227
  • Last Modified:

Newbie Checkbox Question for Powerbuilder 6.5

Ok, I know little to nothing about Powerbuilder, however I have a small task to complete in a PB app that my company uses. The task is very simple and is this.
I have a window that contains 3 separate datawindows. In one of the datawindows "dw_builder_det" I want to add a checkbox. This checkbox is just a yes or no.  The SQL database field that in connects to is called '"moisturesmart_yn". The feild has a default setting of "N". So all builders in this table default to "No" What I want to do is when the user goings into the above window and checks the box it changes the the default value from "N" to "Y". But what I want also is that on checking the box a message is displayed to the user asking them if they're sure they want to proceed with the change. I 'd also like to do the reverse. Once its been changed to "Y" and they remove the check mark, the user is prompted again and the change is reflect in the database. Thats it. Thanks  
0
Duec
Asked:
Duec
1 Solution
 
diasroshanCommented:
hi,

to make the field moisturesmart_yn a check box u need to go to the database painter of the DW first..
next u need to select the field moisturesmart_yn and go to its properties Edit--->Style Type and select checkbox there....
there u can enter the value for 'data value for On' to 'Y'(without the quotes) and value for 'data value for Off' to 'N'....


now to make 'N' the default...
Goto the menu View--->Column Specification

the column specification appears below...
goto the field moisturesmart_yn and make its 'initial value' 'N'(without the quotes)

now for the message Boxes...
goto the item changed event of the DW....
in there write the script...

String ls_yn
If dwo.name = 'moisturesmart_yn' Then
ls_yn=data
If ls_yn = 'Y' Then
MessageBox('Information','Are you sure you want to set moisturesmart to YES' )
Else
MessageBox('Information','Are you sure you want to set moisturesmart to NO' )
End If
End If

That shud sort out ur queries...
Do ask if u need more assistance...

Cheers,
Rosh
0
 
gajender_99Commented:
to make the filed to checkbox

step 1 go to the properties of the field and under edit selecet checkbox from style type.
step 2 click on 3d look

step 3  enter Y for datavalue on and N for data value OFF

step 4 now gor for the itemchanged event for that window by rightclick/script
and enter the folling code

String lsy
long l_answer
If dwo.name = 'moisturesmart_yn' Then
  lsy=data
If lsy = 'Y' Then
    l_answer= MessageBox('Information','Are you sure you want to set YES',StopSign!,YesNo!,2 )
    if l_answer=2 then
       return 1
    End if
End If

If lsy = 'N' Then
    l_answer= MessageBox('Information','Are you sure you want to  No',StopSign!,YesNo!,1 )
    if l_answer=1 then
       return 1
    End if
End If

if you require more information just let give a shout
0
 
DuecAuthor Commented:
Thanks a lot, both answers work fine, I awarded the points to  diasroshan as it was the first answer that I tried and worked. I do have another question how ever reagarding this same job hpwever I willl post it separatley.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now