Filtrer blog posts using variable

I created variable in layout
{variable name=“blogcategory” tab=“Tab” label=“Label” type=“text”}{/variable}

I wanted do filter blog posts with this variable but it doesnt work

{% set posts = blogPosts.posts.whereRelation(‘category’, blogcategory).get() %}