# Check if an event's parameter is global or local

**URL:** <https://qa.fmod.com/t/check-if-an-events-parameter-is-global-or-local/17579>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [August 17, 2021, 6:55pm UTC](https://qa.fmod.com/t/check-if-an-events-parameter-is-global-or-local/17579 "2021-08-17T18:55:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![inbedatnoon](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@inbedatnoon](https://qa.fmod.com/u/inbedatnoon)\
**Post date:** [August 17, 2021, 6:55pm UTC](https://qa.fmod.com/t/check-if-an-events-parameter-is-global-or-local/17579/1 "2021-08-17T18:55:02Z")

</div>

Hello, I’m working on a system that needs to be able to set both global and local parameters using the same function. Currently I am trying to set the parameter and if it fails because it is a global parameter I then use the Studio System. Is there a way to check if an event is global or local first rather than having to try and catch the failure. I’d like to not have the error message from CHECKERR() print out if it is not needed. Below is my current code. Thanks!

```auto
FMOD_RESULT result;
// try and set the parameter as if it is local to the event
result = eventInstance->setParameterByName(paramName.c_str(), value);
ERRCHECK(result);
// if this failed see if it is a global parameter
if (result == FMOD_ERR_INVALID_PARAM){
     result = studioSystem->setParameterByName(paramName.c_str(), value);
     ERRCHECK(result);
}

```

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 19, 2021, 2:31am UTC](https://qa.fmod.com/t/check-if-an-events-parameter-is-global-or-local/17579/2 "2021-08-19T02:31:49Z")

</div>

This seems like as good a way as any of testing if a parameter is global or not- I couldn’t find any nice API hooks for determining whether a parameter is global or not.  
In terms of not printing an error if it’s not needed, you do not need to use ERRCHECK for the first call

```auto
FMOD_RESULT result;
result = eventInstance->setParameterByName(paramName.c_str(), value);
if (result == FMOD_ERR_INVALID_PARAM){
     result = studioSystem->setParameterByName(paramName.c_str(), value);
}
ERRCHECK(result);

```

Edit: We do have a nicer way of finding this out- `EventDescription::getParameterDescriptionByName` returns an [`FMOD_STUDIO_PARAMETER_DESCRIPTION`](https://fmod.com/resources/documentation-api?version=2.01&page=studio-api-common.html#fmod_studio_parameter_description) struct, and on that the `flags` member can be &'d against [`FMOD_STUDIO_PARAMETER_GLOBAL`](https://fmod.com/resources/documentation-api?version=2.01&page=studio-api-common.html#fmod_studio_parameter_flags) to determine if it’s global or not.

---

<div class="post-metadata">

**Author:** ![inbedatnoon](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@inbedatnoon](https://qa.fmod.com/u/inbedatnoon)\
**Post date:** [August 19, 2021, 2:24pm UTC](https://qa.fmod.com/t/check-if-an-events-parameter-is-global-or-local/17579/3 "2021-08-19T14:24:58Z")

</div>

Thank you @jeff_fmod for the help. I think the EventDescription method is the way I’ll do it. Thanks again!
