Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ravikumar_iyana
Creator
Creator

HOW TO MERGE THREE FIELDS INTO ONE FIELD

Hi,

I have a one requirement

date,month,year,

YearMonthDate
2015JUL 201515/07/2015
2016SEP 201624/09/2016
2017JAN 201714/01/2017

AND I required out put as both are same table

Period
2015
2016
2017
JUL 2015
SEP 2016
JAN 2017
15/07/2015
24/09/2016
14/01/2017

Any one can plz help me,

Advance Thanks for your valuable suggestion

7 Replies
kenphamvn
Creator III
Creator III

Try this

Rawtable:

LOAD * inline [

Year, Month, Date

2015, 'JUL 2015', 15/07/2015

2016, 'SEP 2016', 24/09/2016

2017, 'JAN 2017', 14/01/2017

] ;

Option 1 using Concatenate

PeriodTable:

load text(Year) as Period

Resident Rawtable;

Concatenate

load Month as Period

Resident Rawtable;

Concatenate

load Date as Period

Resident Rawtable;

Drop Table Rawtable;

Option 2 using CrossTable

MergeTable:

CrossTable(Colmerge,Period)

load RowNo() as KeyCol, *

Resident Rawtable;

PeriodTable:

load Text(Period) as Period

Resident MergeTable

order by Colmerge desc;

Drop Table MergeTable;

Drop Table Rawtable;

Regards

vishsaggi
Champion III
Champion III

You can try like below too:

CrossTable(Field1,Period)

LOAD 1 AS Flag,

     Year,

     Month,

     Date inline [ 

Year, Month, Date 

2015, 'JUL 2015', 15/07/2015 

2016, 'SEP 2016', 24/09/2016 

2017, 'JAN 2017', 14/01/2017 

];

its_anandrjs

Try with this and create another table if this is you are looking for

Data:

LOAD * Inline

[

Year, Month, Date

2015, JUL 2015, 15/07/2015

2016, SEP 2016, 24/09/2016

2017, JAN 2017, 14/01/2017

];

NewTab:

LOAD

Year as Period

Resident Data;

Concatenate(NewTab)

LOAD

Month as Period

Resident Data;

Concatenate(NewTab)

LOAD

Date as Period

Resident Data;

DROP Table Data;

vinod22kv
Creator
Creator

Hi,

Use this.

tab:

LOAD * INLINE [

    F1, F2, F3

    a, f, k

    b, g, l

    c, h, m

    d, i, n

    e, j, o

];

load F2 as F1 Resident tab;

load F3 as F1 Resident tab;

output as

F1

abcdefghijklmno

ravikumar_iyana
Creator
Creator
Author

Hi,

I am chosen option 1 but doing concatenation all are merging and getting all are date format only like: dd-mm-yyyy

But i required output is :

2015
2016
2017
JUL 2015
SEP 2016
JAN 2017
15/07/2015
24/09/2016
14/01/2017

plz give me your valuable suggestion here

ravikumar_iyana
Creator
Creator
Author

Hi,

I am chosen option 1 but doing concatenation all are merging and getting all are date format only like: dd-mm-yyyy

But i required output is :

2015
2016
2017
JUL 2015
SEP 2016
JAN 2017
15/07/2015
24/09/2016
14/01/2017

plz give me your valuable suggestion here

Kushal_Chawda

Data:

LOAD * Inline

[

Year, Month, Date

2015, JUL 2015, 15/07/2015

2016, SEP 2016, 24/09/2016

2017, JAN 2017, 14/01/2017

];

NewTab:

LOAD

text(Year) as Period

Resident Data;

Concatenate(NewTab)

LOAD

text(Month) as Period

Resident Data;

Concatenate(NewTab)

LOAD

text(Date) as Period

Resident Data;

DROP Table Data;