Advertisement
dandepp

Untitled

Mar 9th, 2023 (edited)
747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //regular version
  2. FOR ALL TAULELL_ANUNCIS
  3.     IF TAULELL_ANUNCIS.CodiEmpleat_Autor = params.userID THEN
  4.         FOR EACH id OF params.idAnunciList
  5.             IF TAULELL_ANUNCIS.TaulellAnuncis_ID = id THEN
  6.                 TAULELL_ANUNCIS.isDeleted = true
  7.                 HModify(TAULELL_ANUNCIS)
  8.                 obj is MTAULELL_ANUNCIS = TAULELL_ANUNCIS
  9.                 arrayAnuncis.Add(obj)
  10.             ELSE
  11.                 RETURN ReturnHFError(500)
  12.             END
  13.         END
  14.     END
  15. END
  16. sToReturn   is ANSI string
  17. Serialize(arrayAnuncis, sToReturn, psdJSON)
  18.  
  19. RETURN sToReturn
  20.  
  21.  
  22. //hashmap version
  23. FOR ALL TAULELL_ANUNCIS
  24.     IF TAULELL_ANUNCIS.CodiEmpleat_Autor = params.userID THEN  
  25.  
  26.         HashIDs is associative array of boolean
  27.         FOR EACH id OF params.idAnunciList
  28.             HashIDs[id] = True
  29.         END
  30.  
  31.         IF HashIDs[TAULELL_ANUNCIS.TaulellAnuncis_ID].Exist THEN
  32.             //TAULELL_ANUNCIS.isDeleted = true                   uncomment when db field is created
  33.             HModify(TAULELL_ANUNCIS)
  34.             obj is MTAULELL_ANUNCIS = TAULELL_ANUNCIS
  35.             arrayAnuncis.Add(obj)
  36.         ELSE
  37.             CONTINUE
  38.         END
  39.     END    
  40. END
  41.  
  42.  
  43. //MONDAY AFTERNOON TRY
  44.  
  45. idTable is associative array of boolean
  46. modifiedRecords is array of MTAULELL_ANUNCIS
  47.  
  48. FOR EACH id OF params.idAnunciList
  49.     idTable[id] = True
  50. END
  51.  
  52. i is int = 1
  53. WHILE i <= HCount(TAULELL_ANUNCIS)
  54.     // Check if Anunci_ID is in the idTable
  55.     HReadSeek(TAULELL_ANUNCIS, Anunci_ID, i, hIdentical)
  56.     IF idTable[TAULELL_ANUNCIS.Anunci_ID] = True THEN
  57.         TAULELL_ANUNCIS.isDeleted = True
  58.         HModify(TAULELL_ANUNCIS)
  59.         modifiedRecords.Add(TAULELL_ANUNCIS)
  60.         idTable[TAULELL_ANUNCIS.Anunci_ID] = False
  61.     END
  62.     i++
  63. END
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement