> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: afterDistinct(value: any, context: HookContext) # Method package: wixDataHooks # Method menu location: wixDataHooks --> afterDistinct # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/data/hooks/wix-data-hooks/after-distinct.md # Method Description: A hook triggered after a distinct query operation. The `afterDistinct()` hook allows you to modify the results of the distinct query before they are returned to the caller. The hook is triggered for each value in the `items` array in the [WixDataQueryResult](https://dev.wix.com/docs/velo/api-reference/wix-data/wix-data-query-result/introduction.md) object. The hook runs after the distinct query operation finishes and before the [`distinct()`](https://dev.wix.com/docs/velo/api-reference/wix-data/wix-data-query/distinct.md) method returns. Return a distinct value or a Promise that resolves to a distinct value. If returning a Promise, the value is used as the result regardless of whether the Promise is fulfilled or rejected. A rejected Promise also triggers the [`onFailure()`](#onFailure) hook, if it has been registered. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## An `afterDistinct()` hook ```javascript // In data.js export function myCollection_afterDistinct(value, context) { let hookContext = context; // See below // Some changes to the distinct value return value; } /* * hookContext: * * { * "collectionName": "myCollection", * "userId": "f45jf8d2-grkj-2opd-4ovk-9rfj4wo5tvj3", * "userRole": "siteOwner" * } */ ``` ## Modify the distinct value before it is returned by `distinct()` ```javascript // In data.js export function myCollection_afterDistinct(value, context) { let hookContext = context; // See below // Convert and display the value as a percentage value = Math.round(value * 100); return value; } /* * hookContext: * * { * "collectionName": "myCollection", * "userId": "f45jf8d2-grkj-2opd-4ovk-9rfj4wo5tvj3", * "userRole": "siteOwner" * } */ ``` ---