Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
amithmurali
Partner - Creator II
Partner - Creator II

Date and Field name in single Column.

Hi Guys,

     I have a problem. in my table, field name and date field are in single column. how to separate the date feild names and make a three columns like date, budget and actual. i have 2 another field's before this namely Department and Region. App Development

            

2014 Jan Actual2015 Jan Budget2015 Jan Actual2014 Feb Actual2015 Feb Budget2015 Feb Actual2014 Mar Actual2015 Mar Budget2015 Mar Actual2014 Apr Actual2015 Apr Budget2015 Apr Actual
14,72,55816,63,99116,81,06213,71,60315,49,91117,41,41312,33,44613,93,79418,86,98613,98,63015,80,45216,70,204
14,41,07216,28,41118,30,59014,65,14816,55,61718,24,82516,59,88418,75,66921,43,52116,85,53219,04,65119,49,451
1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

After the CROSSTABLE LOAD, your column headers will reside as values in a newly created field. Let's say that you called it 'Item' and the Amount has been stored in a field called 'Amount'..

Reload the resulting table in a new resident table by adding these two column definitions:

NewTable:

LOAD Department, Region, Item, Value,

     Date#(Left(Item, 8), 'YYYY MMM') AS DateMY,

     Mid(Item, 10) AS Type

RESIDENT OriginalCrossedTable;

:

Best,

Peter

View solution in original post

6 Replies
giakoum
Partner - Master II
Partner - Master II

try the crosstable function

amithmurali
Partner - Creator II
Partner - Creator II
Author

by using crosstable i can join all the column but, my question is how to seperate the fields , actual,budget and date.

giakoum
Partner - Master II
Partner - Master II

crosstable does not join columns. A typical example could be to have one column per month. To transform a cross table into a straight table, use a crosstable prefix.

Crosstable

A cross table is a common type of table featuring a matrix of values between two or more orthogonal lists of header data, of which one is used as column headers. A typical example could be to have one column per month. To transform a cross table into a straight table, use a crosstable prefix. The result is that the column headers (e.g. month names) will be stored in one field - the attribute field - and the column data (month numbers) will be stored in a second field: the data field.

The syntax is:

crosstable (attribute field name, data field name [ , n ] ) ( loadstatement | selectstatement )

where:

attribute field name is the field to contain the attribute values.

data field name is the field to contain the data values.

n is the number of qualifier fields preceding the table to be transformed to generic form. Default is 1.

Examples:

Crosstable (Month, Sales) Load * from ex1.csv;

Crosstable (Month,Sales,2) Load * from ex2.csv;

Crosstable (A,B) Select * from table3;

buzzy996
Master II
Master II

try with subfiled()

SubField(SubField(`Authoriser comments`,'</p>',1),'<p>',2) as `Authoriser comments`, ----this fumctuion will helps lot to fetch part of field data.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

After the CROSSTABLE LOAD, your column headers will reside as values in a newly created field. Let's say that you called it 'Item' and the Amount has been stored in a field called 'Amount'..

Reload the resulting table in a new resident table by adding these two column definitions:

NewTable:

LOAD Department, Region, Item, Value,

     Date#(Left(Item, 8), 'YYYY MMM') AS DateMY,

     Mid(Item, 10) AS Type

RESIDENT OriginalCrossedTable;

:

Best,

Peter

amithmurali
Partner - Creator II
Partner - Creator II
Author

thanks a lot man. it worked.