DataDictionary tricks
From DataFlex Wiki
Clear but retain parents
Shared by Peter Crook at the forums.
//This clears a child - but not the parents - thus meaning that when you create a new child //you don't have to refind all the parents. Procedure Clear_Retain_Parents // The standard Clear message also clears (non-Constrained) server DDOs. // This does not. Handle hoServer Handle[] hoServerList // the object ids of all this DDO's servers Integer iCount iMax Get Data_Set_Server_Count to iMax Decrement iMax For iCount from 0 to iMax Get Data_Set_Server 0 to hoServer Move hoServer to hoServerList[iCount] Send Detach_Server hoServer Loop Send Clear For iCount from 0 to iMax Move hoServerList[iCount] to hoServer Send Attach_Server hoServer Loop End_Procedure
Field_Checked_State
Normally you'll get the checkbox value and then compare that to whatever value you use for checked or unchecked.
With these methods you immediately get the "checked_state", but at DataDictionary level.
// **WvA: 11-04-1999, created // PRE: The field in question must be a checkbox field // POST: returns TRUE if the field is checked // returns FALSE if the field is unchecked Function Field_Checked_State Integer iField Returns Boolean String sChecked_Value String sValue Get Field_Checkbox_Value iField TRUE To sChecked_Value Get Field_Current_Value iField To sValue Function_Return (sValue = sChecked_Value) End_Function // **WvA: 11-04-1999, created // PRE: The field in question must be a checkbox field // POST: if iState = TRUE the value of the field will be set to the defined TRUE value of the checkbox // if iState = FALSE the value of the field will be set to the unchecked value of the checkbox Procedure Set Field_Checked_State Integer iField Integer iState String sChecked_Value Get Field_Checkbox_Value iField iState To sChecked_Value Set Field_Changed_Value iField To sChecked_Value End_Function Function File_Field_Checked_State Integer iFile Integer iField Returns Boolean Integer iDSO Boolean bChecked Get Data_set iFile To iDSO If iDSO Begin Get Field_Checked_State Of iDSO iField To bChecked End Function_Return bChecked End_Function Procedure Set File_Field_Checked_State Integer iFile Integer iField Boolean bState Integer iDSO Boolean bChecked Get Data_set iFile To iDSO If iDSO Begin Set Field_Checked_State Of iDSO iField To bChecked End End_Function