Guest User

Untitled

a guest
Jul 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. //***********************************************************************
  2. // Function Purpose
  3. // Updates the datawindow and passes the changes to the server.
  4. //
  5. // Arguments
  6. // none
  7. //
  8. // Return Value
  9. // Update Status
  10. //
  11. // Error Return
  12. // -1 - Unsuccessful
  13. // 1 - Successful
  14. //***********************************************************************
  15.  
  16. // Declare Variables
  17. Integer li_columns, li_rows, li_column, li_row
  18. Long ll_rc
  19. DWItemStatus ldw_status
  20. Blob lblb_data
  21.  
  22. // Validate Data Entered
  23. if this.acceptText() <> 1 then
  24.  
  25. // Data Validation Failed
  26. return -1
  27.  
  28. end if
  29.  
  30. // Define Rowcount
  31. li_rows = this.rowcount()
  32.  
  33. // Check Rowcount
  34. if li_rows > 0 then
  35.  
  36. // Define Column Count
  37. li_columns = Integer(this.object.DataWindow.column.count)
  38.  
  39. // Loop through rows check for Null
  40. For li_row = 1 To li_rows
  41.  
  42. // Loop through columns checking for Null
  43. For li_column = 1 To li_columns
  44.  
  45. // Check for Null
  46. If isNull(this.object.data[li_row, li_column]) then
  47.  
  48. // Null found, set focus to field.
  49. this.setRow(li_row)
  50. this.setColumn(li_column)
  51.  
  52. // Exit Script
  53. return -1
  54.  
  55. End if
  56.  
  57. Next
  58.  
  59. Next
  60.  
  61. end if
  62.  
  63. // Check if New Row
  64. ldw_status = this.getItemStatus(this.getRow(), 0, Primary!)
  65.  
  66. if ldw_status = New! or ldw_status = NewModified! then
  67.  
  68. // Check if Row is on Server
  69. ll_rc = in_table_io.of_retrieve(lblb_data, is_updatename, &
  70. integer(this.object.data[this.getRow(), ii_column]))
  71.  
  72. // Row Exists
  73. If ll_rc > 0 then
  74.  
  75. MessageBox(this.classname() + " of_update", &
  76. "That ID has already been taken!")
  77.  
  78. return -1
  79.  
  80. end if
  81.  
  82. end if
  83.  
  84. // Get Datawindow Changes
  85. ll_rc = this.getChanges(lblb_data)
  86.  
  87. if ll_rc < 0 then
  88.  
  89. // Update Failed
  90. return -1
  91.  
  92. else
  93.  
  94. // Send Changes to Server
  95. ll_rc = in_table_io.of_update( lblb_data, is_updatename)
  96.  
  97. // Evalulate Return Code
  98. choose case ll_rc
  99. case 1
  100. // ResetUpdate
  101. this.resetUpdate()
  102.  
  103. // Update Row Status
  104. of_rowstatus()
  105.  
  106. // Return Successful
  107. return 1
  108.  
  109. case -1
  110. // Unsuccesful (Multi-User Conflict)
  111. MessageBox(this.classname() + " of_update", &
  112. "Update failure due to multiuser conflict.~n" + &
  113. "The application will prompt you to refresh the data and,~n" + &
  114. "if desired, re-enter your modifications.")
  115.  
  116. // Set Row Status to Unmodified
  117. this.setItemStatus(0, ii_column, Primary!, NotModified!)
  118.  
  119. // Trigger Retrieve
  120. dynamic of_retrieve()
  121.  
  122. // Return Unsuccessful
  123. return -1
  124.  
  125. case -2
  126. // Return Unsuccessful
  127. return -1
  128.  
  129. end choose
  130.  
  131. end if
  132.  
  133. // Update Failed
  134. return -1
Add Comment
Please, Sign In to add comment