DataWindow control

Functions

CanUndo function

Description

CanUndo function is unsupported.

Workaround

Replace the CanUndo function with ModifiedCount function.

Example

The original code:

if dw_1.CanUndo() Then 
dw_1.Undo() 
end if

The modified code:

if dw_1.ModifiedCount() > 0 Then 
dw_1.Undo() 
End if
DBCancel function

Description

DBCancel function is unsupported.

Workaround

Appeon has its own mechanism to retrieval data. This function can be simply commented out.

Functionality difference

All the retrieved data will be returned at the same time.

GenerateResultSet function

Description

The ResultSet system object and GenerateResultSet method are unsupported.

Workaround

To work around the GenerateResultSet method, we have the following two methods:

Method #1: Use GetFullState to retrieve data from a DataWindow and then use SetFullState to apply the blob returned from GetFullState to another DataWindow.

Method #2: Use the datawindow.data property to retrieve data from a DataWindow into a string and insert data into the DataWindow from the string by ImportString.

GetTrans function

Description

The DataWindow GetTrans function is unsupported.

Workaround

Comment out the unsupported script. Instead use the SetTransObject connection method, to assign a programmer-specified transaction object or a global transaction object called SQLCA to a DataWindow control or DataStore.

To use SetTransObject, write code that performs the following tasks:

  1. Set up the transaction object by assigning values to its fields (usually in the application's Open event).

  2. Connect to the database using the SQL CONNECT statement and the transaction object (in the Open event for the application or window).

  3. Call SetTransObject to associate the transaction object with the DataWindow control or DataStore (usually in the window's Open event).

  4. Check the return value from the Update method and follow it with an SQL COMMIT or ROLLBACK statement, as appropriate.

ReselectRow function

Description

The DataWindow ReselectRow method is unsupported.

Workaround #1

If the DataWindow's source table has a primary key, to work around this issue, follow the steps below:

Step 1: Use GetItem() to get the value of the primary column in the current row.

Step 2: Use SQL statement to retrieve data for the current row according to the value of the primary key.

Step 3: Use SetItem() to assign values to each column in the current row.

Step 4: Change the status of the current row to "NotModified!"

Workaround #2

Replace the ReselectRow function with the Retrieve function.

ResetTransObject function

Description

The ResetTransObject function of a DataWindow control or a DataStore is unsupported.

Workaround

Replace the ResetTransObject function with SetTransObject function.

Example

The original script:

dw_1.ResetTransObject()

The modified script:

dw_1.SetTransObject(transaction)
Scroll function

Description

The Scroll function of DataWindow control is unsupported.

Workaround

Replace the Scroll function with ScrollToRow, ScrollPriorPage or ScrollNextRow function.

Functionality difference

The event sequence of the corresponding function will be triggered.

Example

The original script:

dw_1.Scroll(3)

The modified script. Please note that the event sequence of the ScrollToRow function will be triggered.

dw_1.ScrollToRow(dw_1.GetRow() + 3)
SetTrans function

Description

Using SetTrans to establish a connection to the transaction object is unsupported.

Workaround

Use the SetTransObject method.

Example

The original script:

i = ids_main.SetTrans(itr_sql)

Re-write it using the following format:

ids_main.setTransObject(itr_sql)

Events

ScrollVertical event

Description

ScrollVertical event is unsupported.

Workaround

You can choose either of the following two ways to work around the ScrollVertical event.

To work around the ScrollVertical event for a single DataWindow

Step 1: Define a user-defined event such as ue_scrollvertical to replace ScrollVertical.

Step 2: Place the same code that you plan to put in ScrollVertical in the user-defined event.

Step 3: In the Timer event of the window that hosts the DataWindow, trigger the user-defined event periodically with the following code:

long ll_new_firstrow 
ll_new_firstrow = long(dw_2.Object.DataWindow.firstRowOnPage) // Assuming the DataWindow is dw_2 
if ll_new_firstrow <> il_old_first_row then 
 dw_2.trigger event ue_scrollvertical() 
 il_old_first_row = ll_new_firstrow 
end if

Step 4: Call the Timer event in the Open event of the window with the following code:

timer(0.005)

To work around the ScrollVertical event for ancestor DataWindow

You can code the workaround once in the ancestor DataWindow and then apply it for as many DataWindow as you want.

Supposing the ancestor window is w_sheet and the ancestor DataWindow is u_dw:

Step 1: Start the Timer event in the Open event of w_sheet.

string ls_timer_interval 
ls_timer_interval = & 
ProfileString( gnv_app.of_getappinifile( ), "timer", "interval", "0.005" ); 
timer(Dec(ls_timer_interval));

Step 2: In the pfc_postopen event of w_sheet, add the following code for getting all the DataWindows.

of_sb_get_dwobjects( this.control );

Step 3 - Add a new function called of_sb_get_dwobjects (windowobject awo_control[]) in w_sheet.

int        i; 
tab        lt_tab; 
userobject luo_temp; 
u_dw       lu_dw

for i = 1 to upperbound( awo_control ) 
 if( TypeOf( awo_control[i] ) = Tab! ) then 
  lt_tab = awo_control[i]; 
  of_sb_get_dwobjects( lt_tab.control ); // Recursive call 
 elseif( TypeOf( awo_control[i] ) = UserObject! ) then 
  luo_temp = awo_control[i]; 
  of_sb_get_dwobjects( luo_temp.control ); // Recursive call 
 elseif( TypeOf( awo_control[i] ) = DataWindow! ) then 
  // iu_dw is an instance variable that is an array of u_dw datawindow controls 
  iu_dw[ upperbound(iu_dw) + 1 ] = awo_control[i]; 
 end if 
next

Step 4: In the Timer event for w_sheet, add the following code to check row changes happened to all the DataWindows:

int i

for i = 1 to upperbound(iu_dw)
 iu_dw[i].of_sb_verticalscroll()
next

Step 5: Add an instance variable for u_dw.

long il_old_first_row = -1;

Step 6: Add a new function of_sb_verticalscroll( ) for u_dw.

long ll_new_firstrow, ll_counter // Check if only one row per page is being displayed in dw
ll_new_firstrow = long( this.object.DataWindow.FirstRowOnPage);
if (ll_new_firstrow <> il_old_first_row) then
 il_old_first_row = ll_new_firstrow
 this.trigger event ue_scrollvertical( )
end if;

Step 7: Define a user-defined event for u_dw such as ue_scrollvertical to replace ScrollVertical.

Step 8: Place the same code that you plan to put in ScrollVertical in the user-defined event.

RetrieveRow event

Description

The RetrieveRow event is unsupported.

Workaround

Move the relevant logic to the RetrieveEnd event.

Example

The original script in the RetrieveRow event:

if row < 1 then return
// for every single time, check whether the row should be deleted or not.
if f_find(istr_dwnum.dw,istr_dwnum.id+"='"+this.getitemstring(row,istr_dwnum.id)+"'")>0 then
 this.deleterow(row)
end if

The modified RetrieveEnd event (preceding logic is moved to the RetrieveEnd event):

long li_row
// loop all rows retrieved from the database and find out which row should be deleted.
for li_row = 1 to rowcount
 if f_find(istr_dwnum.dw,istr_dwnum.id+"='"+this.getitemstring(li_row,istr_dwnum.id
 +"'")>0 then
   this.deleterow(li_row)
     li_row --
 end if
next

Properties

LiveScroll property

Description

The LiveScroll property for DataWindow control is unsupported.

Workaround

When the LiveScroll property is enabled, it does not take effect on the Web. A row can only be selected by mouse clicking.