1. Jeong Hwan Jang
  2. PowerBuilder
  3. Thursday, 11 June 2020 07:17 AM UTC

Hi, everyone.

I made a datawindow named 'dw_list' has a CheckBox column as below.

I try to make a process with checked rows in the dw_list, when some button is clicked.

But I don't want ItemStatus of the dw_list to change to Datamodified.

So I wrote the scipt in the itemchanged event like under.

        if dwo.name = 'check_yn' then
             This.SetItemStatus(row, 0, Primary!, NotModified!)
        end if

But dw_list.modifiedcount() is still not 0 after check the CheckBox.

How can I make the datawindow to NotModified?

I'm looking forward to your help.

Thanks.

 

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 11 June 2020 08:22 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

Since you are doing the code in the ItemChanged() event, you are trying to modify the status of things while they still are being modified. Try doing this after the ItemChanged() has finished:

 if dwo.name = 'check_yn' then
       This.POST SetItemStatus(row, 0, Primary!, NotModified!)
end if

 

Also, for some crazy reason, when doing SetItemStatus(), you may have to do more than one call to that function to achieve the final status you want. I don't know why things can't be easier, but it's the way it is.

In the powerbuilder 12.6 help on SetItemStatus() there's this table (the table in the help of pb2017 is a bit clearer):

Table 9-9: Effect of changing from one row status to another

Original status

Specified status

     

New!

New Modified!

Data Modified!

Not Modified!

New!

-

Yes

Yes

No

NewModified!

No

-

Yes

New!

DataModified!

NewModified!

Yes

-

Yes

NotModified!

Yes

Yes

Yes

-

         

For exampe, it shows that if you want to change a status of NewModified! to NotModified!, the result will be New!

If your initial status is NewModified!, than you do this to get a status of NotModfied!:

First: 

This.POST SetItemStatus(row, 0, Primary!, DataModified!) // resulting status will be DataModified!

and after that:

This.POST SetItemStatus(row, 0, Primary!, NotModified!) // resulting status will be NotModified!

 

Anyway, instead of using SetItemStatus() an easier way to achieve what you want is doing this:

This.POST ResetUpdate() // resulting status of all rows will be NotModified!

(but only if you want ALL rows to have itemstatus NotModified!)

regards

Comment
  1. Jeong Hwan Jang
  2. Thursday, 11 June 2020 09:03 AM UTC
Thank you so~~~~~ much !!



I just added "POST", then it works well.



Thank you again.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 11 June 2020 09:09 AM UTC
YW
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.