Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rubenacampos
Contributor III
Contributor III

Creating a new field using multiple if statements in data load editor

I'm trying to create a new field when my data loads based on multiple conditions.  The following fields are loaded with the data load editor:

[Procurement Type]

[Primary Contract Type]

[Procurement Action]

From these fields I would like to create a new field called "COR Type" based on multiple criteria found within the fields above using an IF Statement:

if(([Procurement Type]='SERVICES' or 'R&D' or 'CONSTRUCTION') and ([Primary Contract Type]='Firm Fixed Price' or 'Order Dependent') and ([Procurement Action]<>'*MOD*'),'Type A',
if(([Procurement Type]='SERVICES' or 'R&D' or 'CONSTRUCTION') and ([Primary Contract Type]<>'Firm Fixed Price' or 'Order Dependent' or '*Cost*') and ([Procurement Action]<>'*MOD*'),'Type B',
if(([Procurement Type]='SERVICES' or 'A&E' or 'R&D' or 'CONSTRUCTION') and ([Primary Contract Type]='*Cost*') and ([Procurement Action]<>'*MOD*'),'Type C'))) AS "COR Type"

The new "COR Type" field is created but the results only show Type A and Type B when the [Procurement Type] = Services.  All the other [Procurement Type] are not evaluated nor is the [Primary Contract Type] and [Procurement Action] evaluated.  Thank you in advance for your assistance! 

Labels (3)
1 Solution

Accepted Solutions
Yoshidaqlik
Creator II
Creator II

Hi

fine?

 

try:

if(
	Wildmatch([Procurement Type],'SERVICES','R&D','CONSTRUCTION')>0 and 
	Wildmatch([Primary Contract Type],'Firm Fixed Price','Order Dependent')>0 and 
	Wildmatch([Procurement Action],'*MOD*')=0,
	'Type A',
	
	if(
		Wildmatch([Procurement Type]='SERVICES','R&D','CONSTRUCTION')>0 and 
		Wildmatch([Primary Contract Type],'Firm Fixed Price','Order Dependent','*Cost*')=0 and 
		Wildmatch([Procurement Action],'*MOD*')=0,
		'Type B',
		if(
			Wildmatch([Procurement Type],'SERVICES','A&E','R&D','CONSTRUCTION')>0 and 
			Wildmatch([Primary Contract Type],'*Cost*')>0 and 
			Wildmatch([Procurement Action],'*MOD*')=0,
			'Type C'
		)
	)
) AS "COR Type"

 

Regards

YoshidaQlik https://www.youtube.com/channel/UC1I9P8MqCZEhB6Nw3FdSqng

View solution in original post

2 Replies
Yoshidaqlik
Creator II
Creator II

Hi

fine?

 

try:

if(
	Wildmatch([Procurement Type],'SERVICES','R&D','CONSTRUCTION')>0 and 
	Wildmatch([Primary Contract Type],'Firm Fixed Price','Order Dependent')>0 and 
	Wildmatch([Procurement Action],'*MOD*')=0,
	'Type A',
	
	if(
		Wildmatch([Procurement Type]='SERVICES','R&D','CONSTRUCTION')>0 and 
		Wildmatch([Primary Contract Type],'Firm Fixed Price','Order Dependent','*Cost*')=0 and 
		Wildmatch([Procurement Action],'*MOD*')=0,
		'Type B',
		if(
			Wildmatch([Procurement Type],'SERVICES','A&E','R&D','CONSTRUCTION')>0 and 
			Wildmatch([Primary Contract Type],'*Cost*')>0 and 
			Wildmatch([Procurement Action],'*MOD*')=0,
			'Type C'
		)
	)
) AS "COR Type"

 

Regards

YoshidaQlik https://www.youtube.com/channel/UC1I9P8MqCZEhB6Nw3FdSqng
rubenacampos
Contributor III
Contributor III
Author

THANK YOU, it worked!