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

Add a column in QV

Hi I load the data and create a table like the following:

ProductGrade
A1
B4
C3
D2
E5
F3
G2
H4
I1

But Actually I would like to add a column 'Team' which does not exist in my original dataset. And the table followed is what I want.

TeamProductGrade
X1A1
X2B4
X3C3
D2
X4E5
F3
G2
X5H4
X6I1

What should I do?

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

Orig:

LOAD * Inline [

Product, Grade

A, 3

B, 5

C, 2

D, 1

E, 5

F, 4

G, 1

H, 3

I, 2

];

Final:

NoConcatenate

LOAD

  Product,

  Grade,

  If(Product='A','X1', If(Product='B','X2', If(WildMatch(Product,'C','D','E'),'X3', If(WildMatch(Product,'F','G','H','I'),'X4', 'XX' )))) as Team

Resident Orig;

DROP Table Orig;

View solution in original post

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

I think that Team field is created according to a logic so when you load the original table:

LOAD

     Product,

     Grade,

     if(mycondition, newField, null()) as Team

From ...

Hope it helps

Not applicable
Author

May be I just give a wrong table..Sorry for  that.

What I would like to create is like the following:

TeamProductGrade
X1A3
X2B5
X3C2
D1
E5
X4F4
G1
H3
I2
Anonymous
Not applicable
Author

Hi Jelly,

I suggest you that,

You Can Create Master Excel File for this & You can maintain @ 1 Place.

Which Contains Team & Product. & then you can Map That File with System Data.

Regards,

alexandros17
Partner - Champion III
Partner - Champion III

Orig:

LOAD * Inline [

Product, Grade

A, 3

B, 5

C, 2

D, 1

E, 5

F, 4

G, 1

H, 3

I, 2

];

Final:

NoConcatenate

LOAD

  Product,

  Grade,

  If(Product='A','X1', If(Product='B','X2', If(WildMatch(Product,'C','D','E'),'X3', If(WildMatch(Product,'F','G','H','I'),'X4', 'XX' )))) as Team

Resident Orig;

DROP Table Orig;

Not applicable
Author

Yes your method is work..

What's more..is there a function in QV that could merge the cells?

Not applicable
Author

Thanks..I just try the metod porvided by @Alexandros17 and I can work..