Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to concatenate two numeric fields when loading data from a SQL table into Qlikview. I have tried converting the numeric values into text first but have not been successful. The two approaches I have taken are (note: I have tried these approaches separately):
1. In the LOAD statement, I have used Qlikview's Text() function - e.g. Text(Field1) & Text(Field2) AS NewField
2. In the SQL SELECT statement, I have used SQL's Cast() function - e.g. Cast(Field1 as char) + Cast(Field2 as char) AS NewField
In case 1 I get no values for NewField. In case 2, the debugger states that I am missing an operator (eventhough the same syntax works in SQL Server).
Does anyone have any idea how to do this? Your feedback is greatly appreciated.
Hi,
I tried this and both the options worked for me. I have attached the script for your reference:
table1:
LOAD feature,
Visitors,
Year,
Text(Visitors) as txVisitors,
Text(Year) as txYear,
Text(Visitors)&Text(Year) as TextConcat
FROM(biff, embedded labels, table is Sheet2$);
end if
numsum:
ODBC CONNECT TO dw;
SQL select cast(1 as char(1)) as num1,
cast(2 as char(1)) as num2,1+2 as numsum,
cast(1 as char(1))+cast(2 as char(1)) as concat;
Hope this helps.
-Amit.
Hi,
I tried this and both the options worked for me. I have attached the script for your reference:
table1:
LOAD feature,
Visitors,
Year,
Text(Visitors) as txVisitors,
Text(Year) as txYear,
Text(Visitors)&Text(Year) as TextConcat
FROM(biff, embedded labels, table is Sheet2$);
end if
numsum:
ODBC CONNECT TO dw;
SQL select cast(1 as char(1)) as num1,
cast(2 as char(1)) as num2,1+2 as numsum,
cast(1 as char(1))+cast(2 as char(1)) as concat;
Hope this helps.
-Amit.
Thanks very much for your reply - very helpful!