Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My company has two Divisions. A Spa Division and a Bath Division.
I have two fields
[Field A] contains 'Spa' or 'Bath'
[Field B] conatins the identifier 'Both'
what is the eaiser way to get [field C] to contain all there
[Field C]
Spa
Bath
Both
The following script does this. There may be other ways of doing this.
Tab1:
LOAD Company,FieldB, If(FieldB='Both','Spa',FieldA) as FieldA,If(FieldB='Both','Bath') as FieldA1;
LOAD * Inline [
Company, FieldA, FieldB
C1,Spa,Both
C2,,Both
C3,Spa,
C4,Bath,
C5,Bath,Both
C6,,Both
];
Tab2:
NoConcatenate LOAD Company,FieldA as FieldC Resident Tab1 Where Len(FieldA) <> 0;
Concatenate LOAD Company, FieldB as FieldC Resident Tab1 Where Len(FieldB) <> 0;
Concatenate LOAD Company, FieldA1 as FieldC Resident Tab1 Where Len(FieldA1) <> 0;
Two Questions, in your "field A", do you have blank spaces?or you have both fields A and B all filled?
The following script does this. There may be other ways of doing this.
Tab1:
LOAD Company,FieldB, If(FieldB='Both','Spa',FieldA) as FieldA,If(FieldB='Both','Bath') as FieldA1;
LOAD * Inline [
Company, FieldA, FieldB
C1,Spa,Both
C2,,Both
C3,Spa,
C4,Bath,
C5,Bath,Both
C6,,Both
];
Tab2:
NoConcatenate LOAD Company,FieldA as FieldC Resident Tab1 Where Len(FieldA) <> 0;
Concatenate LOAD Company, FieldB as FieldC Resident Tab1 Where Len(FieldB) <> 0;
Concatenate LOAD Company, FieldA1 as FieldC Resident Tab1 Where Len(FieldA1) <> 0;
[Field A] doesn have an blanks. [Field A] is populated with either 'Spa' or 'Bath'
Teach users that selecting both values in field A already means "both"?
anyway, here you go...
// create new dimension table
LOAD * INLINE [
Field A, Field C
Spa, Spa
Bath, Bath
Spa, Both
Bath, Both
];
Hi
Just use the field B only which contains both Spa and Bath. No need to merge both and create 3rd one.
Cheers.
Thank you, Your script help me to solve my issue.
Thank you, Your script help me to solve my issue.