Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF(OR(function in Load script

Hi,

I need to create a separate column in my load script that I could use to filter out Project data. I have a very heavy data load and will need to create a manual flag in the script. Here is a small piece of my data:

Line of BusinessManufacturerEntityGBU Product TargetProduct Sub-ClassManufacturer TypeStandard Cost SourceQuantityPROJECT SCOPE
OTHERADJ147GRANT REVENUEADJUSTMENTSUNKNOWNNOT APPLICABLE1EXCLUDED
SERVICESI118120INFECTIOUS DISEASEOTHERALERENOT APPLICABLE2EXCLUDED
OTHERADJ10GRANT REVENUEADJUSTMENTSUNKNOWNNOT APPLICABLE1EXCLUDED
OTHERNOT73ROYALTIESOTHERNOT RELEVANTNOT APPLICABLE0EXCLUDED
PRODUCTSI02231MALARIADIAGNOSTIC TESTALERETRANSFER PRICE2EXCLUDED
PRODUCTSI02221MALARIAANTIBODY/ENZYME/REAGENTALERENOT APPLICABLE3EXCLUDED
PRODUCTSI05624HIVDIAGNOSTIC TESTALERENOT APPLICABLE0INCLUDED

I think I will need two columns here:

Column 1: PROJECT SCOPE with the following logic:

If Line of Business = 'SERVICES" then "EXCLUDED"

     if Manufacturer ="I022" then "EXCLUDED"

     if Entity = '147" then EXCLUDED

     if Manufacturer Type = "UNKNOWN" then "EXCLUDED

     if Manufacturer Type = "NOT RELEVANT" then "EXCLUDED

Everything else should be marked as "INCLUDED"

Column2: COST DATA with the following logic

If PROJECT SCOPE = "INCLUDED" and Standard Cost Source ="ICONNECT" then AVAILABLE

elseif Standard Cost Source ="REPACKAGED" then AVAILABLE

elseif Standard Cost Source ="TRANSFER PRICE" then AVAILABLE

when Standard Cost Source is "NOT APPLICABLE" and Product Sub-Class = "SALES BOM" then "AVAILABLE"

when Standard Cost Source is "NOT APPLICABLE" and Product Sub-Class = "ADJUSTMENTS" then "AVAILABLE"

when Standard Cost Source is "NOT APPLICABLE" and Quantity = 0 then "AVAILABLE"

for everything else it should be "UNAVAILABLE"

I really need help with this as soon as possible!!!!!

Thanks a lot!

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

Include the script in your load (or select) script:

Load

....

If (Line of Business = 'SERVICES' or Manufacturer ='I022' or Entity = '147 ' or [Manufacturer Type] = 'UNKNOWN' orManufacturer Type = 'NOT RELEVANT', 'EXCLUDE', 'INCLUDED' as PROJECT_SCOPE,

...

From

...

Where

...


Let me know

View solution in original post

10 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Column 1:

If (Line of Business = 'SERVICES' or Manufacturer ='I022' or Entity = '147 ' or [Manufacturer Type] = 'UNKNOWN' or Manufacturer Type = 'NOT RELEVANT', 'EXCLUDE', 'INCLUDED' as PROJECT_SCOPE

Not applicable
Author

Thank you Alessandro... Should I use INLINE for this?

what function would you use for this?

alexandros17
Partner - Champion III
Partner - Champion III

Include the script in your load (or select) script:

Load

....

If (Line of Business = 'SERVICES' or Manufacturer ='I022' or Entity = '147 ' or [Manufacturer Type] = 'UNKNOWN' orManufacturer Type = 'NOT RELEVANT', 'EXCLUDE', 'INCLUDED' as PROJECT_SCOPE,

...

From

...

Where

...


Let me know

Not applicable
Author

I'm not exactly sure how to write the script statement here... and how many columns to include there

alexandros17
Partner - Champion III
Partner - Champion III

What do you mean?

Not applicable
Author

I think I got it... i asked a questions before seeing your asnwer. I will just include this in my load script not Inline. Thanks a lot... I will let you know if something didnt work.

Not applicable
Author

Alessandro,

When i reload script it always gives me an error

Error in expression:')' expected

Please see my script below:

if([Line of Business]='SERVICES' or [Global Business Unit]='CONSUMER DIAGNOSTICS'or[Global Business Unit]='HEALTH INFORMATION SOLUTIONS' or [Global Business Unit]='CONNECTED HEALTH'or[Entity ID]='147'or [Manufacturer ID]='I154'or [Manufacturer ID]='I088' or[Manufacturer ID]='I015' or [Manufacturer ID]='I022'or[Manufacturer ID]='I034'or [Manufacturer ID]='I124'or [Manufacturer ID]='I115' or [GBU Prd Target]='ROYALTIES'or [GBU Prd Target]='FREIGHT' or [Manufacturer Type] ='NOT RELEVANT' or [Manufacturer Type] ='UNKNOWN','EXCLUDED SEGMENT','INCLUDED PRODUCTS') as [PROJECT_SCOPE] 

vgutkovsky
Master II
Master II

Try to make sure you have a space before and after "or" (so that QlikView knows it's a keyword and not part of the next or previous word).

Vlad

Not applicable
Author

Vlad,

Thanks a lot. It was exactly the case!