| New to PowerBuilder 4 was the datawindow column attribute,
"protect". This attribute allows you to easily enabled and disable input into a
row/column combination. This attribute is very useful when you only want the user to
enter data in key column for new rows. If you right click over a column and select the
attributes... menu option. Scroll the list to the protect attribute.
Enter the following code:
If( IsRowNew() 0, 1) )
Or from Powerscript you could code:
dw_1.Modify("column_name_here.Protect='1~tIf(IsRowNew(),0,1)'")
If your logic is very complicated and you want to use it to enable and disable multiple
columns then create a computed column that returns a value depending on your logic, then
based the expression for the protect attribute on the computed field value. |