Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have a (in my view) straight forward question. Although I couldn't find the answer anywhere...
Q: How can I create a calculated field, after a binary load?
Just Imagine that my code is this:
And that it has a dimension, called 'Country' .
How can I create 'Country_2' which only replaces 1 value (NULL value to the text 'No value')
Many thanks in advance!
After Binary, all the tables will be in memory so you can reference them in a Load statement using the Resident keyword. So if "Country" is in a table named "Countries" something like:
Left Join(Countries)
LOAD *, if(len(Country) = 0, 'No Value', Country) as Country2
Resident Countries
;
Or any other kind of Load, NullAsValue, etc.
-Rob
Maybe like this:
BINARY test.qvw;
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='#.##0,00 €;-#.##0,00 €';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD.MM.YYYY';
SET TimestampFormat='DD.MM.YYYY hh:mm:ss[.fff]';
SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;
SET FirstMonthOfYear=1;
SET CollationLocale='de-DE';
SET MonthNames='Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sep.;Okt.;Nov.;Dez.';
SET LongMonthNames='Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember';
SET DayNames='Mo.;Di.;Mi.;Do.;Fr.;Sa.;So.';
SET LongDayNames='Montag;Dienstag;Mittwoch;Donnerstag;Freitag;Samstag;Sonntag';
NULLASVALUE Country2;
SET NullValue = 'No value';
NoConcatenate
Final:
Load *, Country as Country2 Resident test;DROP table test;
After Binary, all the tables will be in memory so you can reference them in a Load statement using the Resident keyword. So if "Country" is in a table named "Countries" something like:
Left Join(Countries)
LOAD *, if(len(Country) = 0, 'No Value', Country) as Country2
Resident Countries
;
Or any other kind of Load, NullAsValue, etc.
-Rob