May be I wasn't clear enough, but the text in red is the error message, not the script. Anyway, I tried to sorround "$(loggedUser)" with single quotes and it worked...
LOAD TextCount(a) as test Resident tbPermissions Where a = '$(loggedUser)';
I thought that anything inside single quotes would be interpreted as a string, I didn't realyze it would process "$(loggedUser)" first and evaluate the entire result with single quotes after.
God bless you! Regards,