Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
All
I'm having issues using the If statement on the scripting back end of QlikView
Can somebody explain why this doesn't work?
If Left([Insurer Policy Number],7) = 'GSPC701' Then 'Skippy'
Else 'Sampras'
End If as [Test],
Thanks in advance
Have you tried this?
Load *,
If ( Left([Insurer Policy Number],7) = 'GSPC701' ,'Skippy' ,'Sampras' ) as Test ;
SQL SELECT
*
FROM SkippyReporting.dbo.Core_Product_All_Txns;
James
Your syntax for a QlikView script was adrift, try something like this:
If ( Left([Insurer Policy Number],7) = 'GSPC701' ,'Skippy' ,'Sampras' ) as [Test] ,
Best Regards, Bill
Only this part.
If Left([Insurer Policy Number],7) = 'GSPC701' , 'Skippy', 'Sampras') as [Test]
That is SQL Case Statment Syntax...
I am putting this in a SQL selectstatement. But it doesn’t work (see below)
SQL SELECT
If ( Left([Insurer Policy Number],7) = 'GSPC701','Skippy' ,'Sampras' ) as [Test] ,
*
FROM SkippyReporting.dbo.Core_Product_All_Txns;
James
Ahh, I misunderstood you I thought you were talking about a QV Load Script statement.
What brand of database are you trying to do this SQL query against ?
Best Regards, Bill
You cannot use Qlikview expression in sql statement rather you can use it on preceding load.
try this
Load *,
If ( Left([Insurer Policy Number],7) = 'GSPC701','Skippy' ,'Sampras' ) as [Test];
SQL SELECT
*
FROM SkippyReporting.dbo.Core_Product_All_Txns;
Apologies
it is a QV load script. this is the entie script below.
ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='£#,##0.00;-£#,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
ODBC CONNECT TO lassie (XUserId is GaLDOJdJDaSYFVFMNLZGHXUNBbaKGYVMBbYKWdA);
SQL SELECT
If ( Left([Insurer Policy Number],7) = 'GSPC701' ,'Skippy' ,'Sampras' ) as [Test] ,
*
FROM SkippyReporting.dbo.Core_Product_All_Txns;
HI
I just tried this to no avail.
ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='£#,##0.00;-£#,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
Load
*,
If ( Left([Insurer Policy Number],7) = 'GSPC701','Skippy' ,'Sampras' ) as [Test]
;
ODBC CONNECT TO lassie (XUserId is GaLDOJdJDaSYFVFMNLZGHXUNBbaKGYVMBbYKWdA);
SQL SELECT
*
FROM SkippyReporting.dbo.Core_Product_All_Txns;
Qlikview execute the statement after the SQL word in the database only not within qlikview, so qlikview expressions cannot used there.
Can you suggest a solution?
Thanks for your help