Link to home
Start Free TrialLog in
Avatar of Duec
DuecFlag for Canada

asked on

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  
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gajender_99
gajender_99

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
Avatar of Duec

ASKER

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.