Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I was going throgh the manual and i am not able to understand the meaning of 'n' the query mentioned below :
crosstable(attribute field,data field[,n](loadstatement/selectstatement).
Plz help me to understand this with an ex.
Thanks in advance
n is the (optional) number of qualifier fields preceding the table to be transformed to generic form. Default is 1.
Examples:
Crosstable (Month, Sales) Load Customer, Jan, Feb, Mar, Apr from ex1.csv;
Resulting table contains fields Customer, Month and Sales.
Crosstable (Month,Sales,2) Load Customer, SalesRep, Jan, Feb, Mar, Apr from ex2.csv;
Resulting table contains fields Customer, SalesRep, Month and Sales.
So n denotes the number of fields that are not transformed, counting from the beginning of your LOAD / Select field list.
The n is the number of columns on the left that should stay as they are.
crosstable(Month, Value, 2)
LOAD
Customer,
Region,
Jan,
Feb,
Mar,
....etc
from mytable;
In the above example we want to keep the fields Customer and Region as they are and transform the month columns to two fields named Month and Value. Because we want to keep two fields are they are the n value for the crosstable function is 2.
crosstable(Month, Value, 3)
LOAD
Customer,
Region,
SalesPerson,
Jan,
Feb,
Mar,
....etc
from mytable;
In this example there are now three fields we like to keep as they are, so the n value for the crosstable function is now 3.