Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
tresesco
MVP
MVP

Try:

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

View solution in original post

8 Replies
tresesco
MVP
MVP

Try:

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

Not applicable
Author

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]

tresesco
MVP
MVP

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
Author

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

tresesco
MVP
MVP

Please post your sample app or atleast the script section

Not applicable
Author

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

tresesco
MVP
MVP

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
Author

It worked!

Fantastic!

Much appreciated!