0
votes

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
2

2 Answers

0
votes
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
0
votes

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)