Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***********************************************************************
- // Function Purpose
- // Updates the datawindow and passes the changes to the server.
- //
- // Arguments
- // none
- //
- // Return Value
- // Update Status
- //
- // Error Return
- // -1 - Unsuccessful
- // 1 - Successful
- //***********************************************************************
- // Declare Variables
- Integer li_columns, li_rows, li_column, li_row
- Long ll_rc
- DWItemStatus ldw_status
- Blob lblb_data
- // Validate Data Entered
- if this.acceptText() <> 1 then
- // Data Validation Failed
- return -1
- end if
- // Define Rowcount
- li_rows = this.rowcount()
- // Check Rowcount
- if li_rows > 0 then
- // Define Column Count
- li_columns = Integer(this.object.DataWindow.column.count)
- // Loop through rows check for Null
- For li_row = 1 To li_rows
- // Loop through columns checking for Null
- For li_column = 1 To li_columns
- // Check for Null
- If isNull(this.object.data[li_row, li_column]) then
- // Null found, set focus to field.
- this.setRow(li_row)
- this.setColumn(li_column)
- // Exit Script
- return -1
- End if
- Next
- Next
- end if
- // Check if New Row
- ldw_status = this.getItemStatus(this.getRow(), 0, Primary!)
- if ldw_status = New! or ldw_status = NewModified! then
- // Check if Row is on Server
- ll_rc = in_table_io.of_retrieve(lblb_data, is_updatename, &
- integer(this.object.data[this.getRow(), ii_column]))
- // Row Exists
- If ll_rc > 0 then
- MessageBox(this.classname() + " of_update", &
- "That ID has already been taken!")
- return -1
- end if
- end if
- // Get Datawindow Changes
- ll_rc = this.getChanges(lblb_data)
- if ll_rc < 0 then
- // Update Failed
- return -1
- else
- // Send Changes to Server
- ll_rc = in_table_io.of_update( lblb_data, is_updatename)
- // Evalulate Return Code
- choose case ll_rc
- case 1
- // ResetUpdate
- this.resetUpdate()
- // Update Row Status
- of_rowstatus()
- // Return Successful
- return 1
- case -1
- // Unsuccesful (Multi-User Conflict)
- MessageBox(this.classname() + " of_update", &
- "Update failure due to multiuser conflict.~n" + &
- "The application will prompt you to refresh the data and,~n" + &
- "if desired, re-enter your modifications.")
- // Set Row Status to Unmodified
- this.setItemStatus(0, ii_column, Primary!, NotModified!)
- // Trigger Retrieve
- dynamic of_retrieve()
- // Return Unsuccessful
- return -1
- case -2
- // Return Unsuccessful
- return -1
- end choose
- end if
- // Update Failed
- return -1
Add Comment
Please, Sign In to add comment