> For the complete documentation index, see [llms.txt](https://mujahid.gitbook.io/decast-gating-document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mujahid.gitbook.io/decast-gating-document/helper-view-functions/checktokenidexistsforeventid.md).

# checkTokenIdExistsForEventId

This view function checks if a specific token ID exists for a given event. It takes two parameters:

* `_eventId`: The unique identifier for the event.
* `_tokenId`: The token ID to be checked for existence.

````solidity
// Some code

```remix-solidity
/**
    CheckTokenIdExistsForEventId: Check if a specific token ID exists for a given event.
    @param _eventId: The unique identifier for the event.
    @param _tokenId: The token ID to be checked for existence.
    @return bool: A boolean indicating whether the token ID exists for the event.
    */
    function checkTokenIdExistsForEventId(
        string calldata _eventId,
        uint256 _tokenId
    ) public view returns (bool) {
        // Retrieve all token IDs associated with the event
        uint256[] memory _tokenIds = getTokenIdsFromEventId(_eventId);
        // Loop through token IDs to check for the existence of the specified token ID
        for (uint256 i = 0; i < _tokenIds.length; ++i) {
            if (_tokenIds[i] == _tokenId) {
                return true;
            }
        }
        return false;
    }
```
````

## Explanation:

The function retrieves all token IDs associated with the event using the [`getTokenIdsFromEventId` ](/decast-gating-document/getter-view-functions.md)function. Then, it iterates through these token IDs to check if the specified token ID exists among them. If it finds a match, indicating that the token ID exists for the event, the function returns `true`; otherwise, it returns `false`.
