Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Loading issue - involving IF statement


Hey guys,

I'm trying to load the following script into Qlikview:

Load

[Client Name] As Client_Name,

[Account Number],
[Portfolio Name],
if(len(Client_Name) = 0, 'Fail','Pass') as Client_Name_No_Data
//     if([Client Name] = "0", 'Fail','Pass') as Client_Name_Wrong_Data,
//     if(sum([Client Name]) > 0, 'Numerical','Alphabetical') as [Alphabetical/Numerical],

From

Having issues as it wont recognise the 'Client Name'. I've tried it without renaming [Client Name] As Client_Name as well. When loading with out the If Statement - it works fine.

Can anybody assist please?

Kind Regards

Mav

1 Solution

Accepted Solutions
MVP
MVP

Re: Loading issue - involving IF statement

Try:

if(len([Client Name] ) = 0, 'Fail','Pass') as Client_Name_No_Data

8 Replies
MVP
MVP

Re: Loading issue - involving IF statement

Try:

if(len([Client Name] ) = 0, 'Fail','Pass') as Client_Name_No_Data

Not applicable

Re: Loading issue - involving IF statement

Hey guys,

That seemed to have worked, but I encountered another issue. The below statement returns an error in the statement which I cant seem to locate.

if(sum([Client Name]) => 0, 'Numerical','Alphabetical') as [Alphabetical/Numerical]

MVP
MVP

Re: Loading issue - involving IF statement

Sum is an aggregation function. If you use one, there has to be a 'Group By' clause. Are you using that? What is the error message you are getting?

Not applicable

Re: Loading issue - involving IF statement

Error in expression ')' expected. No I haven't used group by? I'm fairly new to scripting in QV altogether.

MVP
MVP

Re: Loading issue - involving IF statement

Please post your sample app or atleast the script section

Not applicable

Re: Loading issue - involving IF statement

LOAD [Client Name],
   
[Account Number],
   
[Portfolio Name],
   
[Transaction Identifier],
   
[Firm’s Internal Transaction Reference],
   
[Transaction Date],
   
[PO Instrument Name],
   
[FCA Qualified Transaction],
   
[FCA Non Qualified Transaction Reason],
   
[FCA Sent Transaction],
   
[FCA Rejected Transaction],
   
[Transaction Type],
   
[Instrument Type],
   
IPO,
   
[Trading Capacity],
   
[Trading Exchange],
   
[Account Type],     
   
if(len([Client Name]) = 0, 'Fail','Pass') as Client_Name_No_Data,
   
if([Client Name] = 0, 'Fail','Pass') as Client_Name_Wrong_Data,
   
if(sum([Client Name]) => 0, 'Numerical','Alphabetical') as [Alphabetical/Numerical]
FROM

MVP
MVP

Re: Loading issue - involving IF statement

If you are only checking if the client name is a text or number then don't use sum() function. Try like:

if( IsNum([Client Name]), 'Numerical','Alphabetical') as [Alphabetical_Numerical] 

Not applicable

Re: Loading issue - involving IF statement

It worked!

Fantastic!

Much appreciated!

Community Browser