Advertisement
dandepp

Untitled

Mar 9th, 2023 (edited)
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Create an empty associative array
  2. HashIDs is associative array of bool
  3.  
  4. // Populate the associative array with values from the "idAnunciList" parameter
  5. FOR EACH id OF params.idAnunciList
  6.     HashIDs[id] = True
  7. END
  8.  
  9. // Create a list to store the IDs of the selected records
  10. listIDs is List of Integer
  11.  
  12. // Add the IDs of the selected records to the list
  13. FOR EACH TAULELL_ANUNCIS
  14.     IF TAULELL_ANUNCIS.CodiEmpleat_Autor = params.userID AND HashIDs[TAULELL_ANUNCIS.TaulellAnuncis_ID].Exists THEN
  15.         listIDs.Add(TAULELL_ANUNCIS.TaulellAnuncis_ID)
  16.     END
  17. END
  18.  
  19. // Use SQL queries to modify and update the selected records
  20. IF listIDs.Count > 0 THEN
  21.     sQuery is string = "UPDATE TAULELL_ANUNCIS SET isDeleted = true WHERE TaulellAnuncis_ID IN (" + Join(listIDs, ",") + ")"
  22.    
  23.     // Execute the SQL query to update the records
  24.     HExecuteSQLUpdate(sQuery)
  25.  
  26.     // Read the modified records and add them to the array
  27.     FOR EACH ID IN listIDs
  28.         taulellAnuncis is MTAULELL_ANUNCIS
  29.         taulellAnuncis.Read(ID)
  30.         obj is MTAULELL_ANUNCIS = taulellAnuncis
  31.         arrayAnuncis.Add(obj)
  32.     END
  33.  
  34.     // Serialize the modified records and return the result
  35.     sToReturn is ANSI string
  36.     Serialize(arrayAnuncis, sToReturn, psdJSON)
  37.     RETURN sToReturn
  38. ELSE
  39.     // If no records were selected, return an empty array
  40.     sToReturn is ANSI string
  41.     Serialize(arrayAnuncis, sToReturn, psdJSON)
  42.     RETURN sToReturn
  43. END
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement