Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts
I have this in my script:
if(match ([Accident], 'false') or len([Accident])=0 and
match(Category,'Incident', 'Accident', 'Fatality'),'X',0) as [Result]
But this is not working. For "Accident" two of the values are relevant, either 'false" or Null. Additionally we need to check on Category with the values mentioned above.
Where is the error?
Thank you!
Hi,
What about using IsNull() function instead of Len() ?
Then your formula would look sth like this:
if(match ([Accident], 'false') or IsNull([Accident]) and
match(Category,'Incident', 'Accident', 'Fatality'),'X',0) as [Result]
I just also realised you might need to put your first logical condtion inside additional brackets:
if( ( match ([Accident], 'false') or len([Accident])=0 ) and
match(Category,'Incident', 'Accident', 'Fatality'),'X',0) as [Result]
Hi @TomBond77
Do you have a sample dataset to use for testing?
Using the below (And just adding trim) it seems to work??
Load
*,
(if(match ([Accident], 'FALSE') or len(Trim([Accident]))=0) and
match(Category,'Incident', 'Accident', 'Fatality'),'X',0) as [Result];
Load * Inline [
Rec,Accident,Category
1,TRUE,Incident
2,FALSE,Accident
3,,Accident
4,TRUE,Fatality
5,TRUE,Fatality
6,,Accident
7,FALSE,Incident
];
Regards Jandre
Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn