Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
viveksingh
Creator III
Creator III

condition based dimension in script

HI Experts,

I have a data like below

praveen1.jpg

if you observe in the above, Description have different values. Based on a particular value(Failed)  all the values of description should be Failed for ABC01 value else it should be Success. 

Below is the expected for reference

Prv2.jpg 

I want to derive in load script. Please share your comments. 

Thanks in advance. 

Labels (2)
4 Replies
Marcos_rv
Creator II
Creator II

try this:
MAIN:
load
name, description
from MAIN.QVD;

aux_1:
LOAD
name ,
if ( wildmatch(aux , 'Failed' ) > 0 ) , 'Failed' , 'Success' ) status_1;
LOAD name , concat(description) as aux
resident main
GROUP BY name ;

left join (MAIN)
load name , status_1 as status
resident aux_1;
drop table aux_1;

saludos!!!
viveksingh
Creator III
Creator III
Author

Thanks for the reply. But this is not working as expected. 

Can help to provide another type of solution/work around please. 

Brett_Bleess
Former Employee
Former Employee

Vivek, you would need to use Group by or Order by in the load and then use the Peek() function I believe to check for that string and if you hit it, then 'map' the other status values all to Failed at that point, but I am afraid I cannot code this for you, only point you in the right direction.  Someone else may still chime in though, as my comment will kick things back up in the list again, so maybe someone else will be able to share some code, but you could also search prior posts, as I am pretty sure you will find some examples out there that will help you get things right on this one, as this is fairly comment scenario.  Sorry I do not have better for you.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

In load script:

Data:

load *, if(Name='ABC 01','Failed','Success')as Status

resident <YourTableName>;

drop table <YourTableName>;