How I update the template variable with the last value selected?
I need to know how I get the value selected

I see this API modx getTemplateVarOutput($idname=array(), $docid="", $published="1");
but I don’t know how I made
I have this query: @select country, id_country FROM country WHERE continent=getTemplateVarOutput($idname=array(), $docid="61", $published="1");
I don’t know if it is correct... but doesn’t work
how I update the next variable with the value selected?