How to disable a single row in a datawindow?

5.5k views Asked by At

Can anybody help me that how can I protect individual column of an individual row, though my datawindow has more than one row. I am writing a code like this:

dw_1.Modify("column_name.protect = '1'")

However it is making all my rows disabled.

3

There are 3 answers

0
Matt Balent On BEST ANSWER

You need to have some sort of conditional statement for the particular row/column you wish to protect. One way is to have an additional field you set programatically like.

dw_1.setitem(1,"protect_me","Y")

Then in your other column you set an expression on the protect property like:

if(protect_me[0] = "Y", 1, 0)
2
ali.boussouf On

You cane make it like : dw_1.SetRedraw ( FALSE )

ls_modstring = as_columnnane + ".background.color = '" + String(RGB( 255, 255, 255 )) + &
                    "~tIf( protection = 1," + String(RGB( 192, 192, 192 )) + "," + &
                    String(RGB( 255, 255, 255)) + ")'"
dw_1.Modify( ls_modstring )

ls_modstring = as_columnnane + ".protect = '0 ~tIf( protection = 1, 1, 0 )'"
dw_1.Modify( ls_modstring )

dw_1.SetRedraw ( TRUE )

Where as_columnnane is the column name.

0
Masa sih On

Hi Santosh Kumar Dutta,

I suggest you use datawindow protect properties instead of modify syntax. could you please give us exact small code based on what field or condition you want to protect.

from pb_developer