0

I have a DataWindow object with these three columns:

  • status - which is a checkbox
  • criteria - which is a dropdownDW
  • another

When status is 1 (checked) then criteria.Protect='0'. If the user chooses from the criteria list "another criteria", then another.Protect='0' and the user can write whatever he wants.

The problem is when the user changes his mind and uncheck the status. The criteria and the another column have the last values he chose/wrote before. How can I reset the dropdownDW or how can I have the default values back?

In the itemchange event I have this:

choose case dwo.name
  case "status"
    if  data ='0' then
      dw_list.modify("criteria.Protect='1'")
      dw_list.modify("another.Protect='1'")
    else
      dw_list.modify("criteria.Protect='0'")
    end if
dda
  • 6,030
  • 2
  • 25
  • 34
XLD_a
  • 195
  • 1
  • 4
  • 16

2 Answers2

0
String ls_criteriaProtect
String ls_anotherProtect

//Save default values:
ls_criteriaProtect = dw_list.describe( "criteria.Protect" )
ls_anotherProtect = dw_list.describe( "another.Protect" )

choose case dwo.name
  case "status"
    if  data ='0' then
      dw_list.modify("criteria.Protect='1'")
      dw_list.modify("another.Protect='1'")
    else
      dw_list.modify("criteria.Protect='0'")
    end if
  case else

      //Apply initial values:
      dw_list.modify( "criteria.Protect='" + ls_criteriaProtect  + "'" )
      dw_list.modify( "another.Protect='" + ls_anotherProtect  + "'" )
End Choose
Eduardo G.
  • 341
  • 1
  • 7
  • The OP would like to perform a kind of rollback if the user unchecks the box. – Seki Apr 05 '17 at 07:29
  • This has nothing to do with "commit" or "rollback"... The OP just wants to reset the values in the "criteria" and "another" column back to the default values when the user changes his mind and unchecks the checkbox. Just add a "this.setItem( row, "criteria", )" and "this.setItem( row, "another", )" into your existing itemChanged event. – Paul Horan Apr 10 '17 at 15:04
0

Use an expression on the Protect property of the status column within the datawindow object.

Something like:

case (describe('criteria.protect') when '0' then 1 else 0)
Matt Balent
  • 2,337
  • 2
  • 20
  • 23