Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Im trying to return word Egg on my table on Field that says Y and Blank if its N of blank.
Database contains Y,N and blank
May be this
If([alg-code] = 'EGG' and [alg-stat] = 'Y', 'Egg', Null()) as Egg
Allergy_tmp:
Load Distinct [p-code],
MaxString(If([alg-code]='GLUT',[alg-stat])) as Gluten,
MaxString(If([alg-code]='EGG',[alg-stat])) as Egg,
MaxString(If([alg-code]='CRUS',[alg-stat])) as Crustaceans,
MaxString(If([alg-code]='CLRY',[alg-stat])) as Celery,
MaxString(If([alg-code]='SOY',[alg-stat])) as Soyabeans,
MaxString(If([alg-code]='SESM',[alg-stat])) as Sesame,
MaxString(If([alg-code]='SO2',[alg-stat])) as Sulphur_Dioxide,
MaxString(If([alg-code]='LUP',[alg-stat])) as Lupin,
MaxString(If([alg-code]='MILK',[alg-stat])) as Milk,
MaxString(If([alg-code]='PNUT',[alg-stat])) as Peanuts,
MaxString(If([alg-code]='NUT',[alg-stat])) as Treenuts,
MaxString(If([alg-code]='MSTD',[alg-stat])) as Mustard,
MaxString(If([alg-code]='FISH',[alg-stat])) as Fish,
MaxString(If([alg-code]='MLSC',[alg-stat])) as Molluscs
Resident Products
Group By [p-code];
Drop Fields [alg-code],[alg-stat] from Products;
tmp:
NoConcatenate
Load Distinct *
resident Products;
Drop Table Products;
RENAME table tmp to Products;
Left Join(Products)
Load [p-code],
Gluten,
Egg,
Crustaceans,
Celery,
Soyabeans,
Sesame,
Sulphur_Dioxide,
Lupin,
Milk,
Peanuts,
Treenuts,
Mustard,
Fish,
Molluscs
Resident Allergy_tmp;
Drop Table Allergy_tmp;
Above is the whole script and works but returning Y or N under each alg-code
what im trying to archieve is replace Y with the name each alg code.
Hope makes sense