# Google Analytics

Deleting a Cyclegroup member not possible

Problem

An attempt to delete a member of a cycle group leads to the message "Error while accessing the Database". 

After the message was acknowledged, the user is still in the list

Solution

The problem is a result of a double entry of the user on the Database level. It can ONLY be solved on the SQL level. Therefore a user MUST have access to that level.

Users with no possibility to access the SQL level need to talk to their IT (On-Premise installation) or to iGrafx Customer Support (Cloud installation hosted by iGrafx)

Three steps must be performed
  1. Find Cyclegroups with duplicate entries
    To do that, the following SQL script must be executed. Make sure, that you use the proper prefix for your Repository (FROM [dbo].[<PREFIX>_ApprovalLog].....)

    SELECT [ObjectID]
          ,[VersionNumber]
          ,[ApprovalCycle]
          ,[EntryType]
          ,[User]
          ,[GroupType],
          COUNT(*) AS [Votes]
      FROM [dbo].[r1_ApprovalLog] WHERE [EntryType]=7 GROUP BY [ObjectID]
          ,[VersionNumber]
          ,[ApprovalCycle]
          ,[EntryType]
          ,[User]
          ,[GroupType] HAVING COUNT(*)>1 
    Collapse

    As a result you will get a list of Object-IDs that reflect Cyclegroups with double entries

  2. For every Object-ID found we need to find the exact double entries. The following script helps us with that. 
    Substitute the [ObjectID]=0000 with the one you found, then execute the command

    SELECT TOP (1000) [ObjectID]
          ,[VersionNumber]
          ,[ApprovalCycle]
          ,[EntryType]
          ,[User]
          ,[Time]
          ,[Comment]
          ,[SignatureID]
          ,[GroupType]
      FROM [dbo].[r1_ApprovalLog] WHERE [ObjectID]=0000 ORDER BY [ApprovalCycle] DESC
  3. Now you got the double entry details and can delete them with the following command. 
    Make sure to substitute ObjectID, GroupType, User and Time with the proper values.

    DELETE FROM [r1_ApprovalLog] WHERE [ObjectID]=0000 AND [EntryType]=7 and [GroupType]=2 and [User]='xxx' AND [Time]='2020-02-18 09:55:07.597'

Step 2 and 3 have to be repeated for all findings. 

To make double sure, that everything was fixed run Step 1 again. When no more is found you have won.