powerbuilder , check datawindow status

Posted on 2009-05-21
Medium Priority
Last Modified: 2013-12-26
suppose that we have a window that contains datawindow dw_1. suppose that the users starts entering data  and by mistake closes the window before save them. We want to send him a message indicating that the changes that he made will be lost.  we want deal with this issue in the following cases.

1) if the user enters data to store them in a new record (no retrieve has been done)
2) if the user retireves a record and correct some data in it

how can we do it?

Question by:basilhs_s
  • 3
  • 2
  • 2

Expert Comment

ID: 24440317
You can use  modifiedcount, getitemstatus function of datawindow to achieve this..see PB help for syntax and all.

write those scripts in closequery event of the window,

if something modified or added or deleted then put a messagebox and ask do you want to save changes,
then based on response save the datawindow and close or stop closing by returning 1 from closequery event.


Accepted Solution

gafoor78 earned 1400 total points
ID: 24440487
You can do something like below in the closequery event of your window,

if dw_1.modifiedcount() > 0 and cb_save.enabled = true then // u can use getitemstatus fn also based on your requirement here
            li_i = MessageBox("title", "Do you want to save changes?",  &
                   question!, YesNocancel!, 2)
            choose case li_i
                  case 1
                  case 2
                  case 3
                        return 1
            end choose
end if
LVL 14

Assisted Solution

sandeep_patel earned 600 total points
ID: 24440904
To save the records that is deleted but not saved, you need to use deletedcount() also
If dw_1.modifiedcount() > 0 OR dw_1.deletedcount() > 0 Then
End If

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.


Author Comment

ID: 24446139
thanks all for the reply. suppose that we do the save. will this event reset all the counters you mentioned ?
do we have to retrieve the data again?
LVL 14

Expert Comment

ID: 24446417
yes it will reset the count. No need to retrieve the data again
LVL 14

Assisted Solution

sandeep_patel earned 600 total points
ID: 24446438
to be more specific... there are two arguments in Update(). The second argument is to reset this flags. Default value is always TRUE and it will reset the counts. If it is FALSE then it won't reset.

see pb help for Update function, it's explained in detail there.


Author Closing Comment

ID: 31583864
thans very much

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question