Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to exclude the math courses equal from Student after using subfield but I got error "StudentsExclude.%Key not exists". what i have done wrong?
Students:
LOAD
%Key,
FirstName,
LastName,
Courses,
Gender,
BirthDay
RESIDENT FACT
StudentsALL:
%Key,
SubField(Courses, ';') AS Course
RESIDENT Students
STORE StudentsALL INTO [lib://DEMO/StudentsALL.QVD](qvd);
StudentsExclude:
LOAD DISTINCT %Key
RESIDENT StudentsALL
WHERE Course= 'Math';
StudentsExcludeMath:
LOAD *
RESIDENT Students
WHERE NOT Exists(StudentsExclude.%Key);
STORE StudentsExcludeMath INTO [lib://DEMO/StudentsExcludeMath.QVD](qvd);
Change your load script
StudentsExcludeMath:
LOAD *
RESIDENT Students
WHERE NOT Exists(%Key);
This: StudentsExclude.%Key indicates that any qualifying is applied. I suggest to remove it completely because it's very seldom an added value (only in specific cases for experienced users) else it will cause a lot of trouble.
Excluding the qualification will not solve the problem that is asked about.
Sure the script will run but exclude everything since every %Key already exists!
I suggest this;
StudentsExclude:
LOAD DISTINCT %Key as %ExcludeKey
RESIDENT StudentsALL
WHERE Course= 'Math';
StudentsExcludeMath:
LOAD *
RESIDENT Students
WHERE NOT Exists(%ExcludeKey, %Key);