Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

"File not found" error when calling a variable in a LOAD statement

Hi,

I'm new to QlikView and have one basic question: Why the code below (script edit) doesn't work?

LET loggedUser=OSUser();

tbPermissions:

LOAD a,

     b,

     c,

     d,

     e,

     f,

     g

FROM

C:\Projects\QlikView\Permissions.xls

(biff, embedded labels, table is Plan1$);

LOAD TextCount(a) as test Resident tbPermissions Where a = $(loggedUser);

I get the following error when the script is reloaded:

Field not found - <MYDOMAIN\myuser>

LOAD TextCount(PRINCIPAIS_NUMEROS) as visualizaPrincipaisNumeros Resident tbPermissoes Where PRINCIPAIS_NUMEROS = MYDOMAIN\myuser

It seems the that the user name is not interpreted as a String. The code below works, but I really need to use the variable "loggedUser":

LOAD TextCount(a) as test Resident tbPermissions Where a = OSUser();

I am using QlikView Personal Edition for Windows, version 10.00.9061.7 SR3.

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

you are missing single quotes Where PRINCIPAIS_NUMEROS = 'MYDOMAIN\myuser'

View solution in original post

2 Replies
danielrozental
Master II
Master II

you are missing single quotes Where PRINCIPAIS_NUMEROS = 'MYDOMAIN\myuser'

Not applicable
Author

Daniel,

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,

Marcel