I need to compare the customer_id's in the same table, and create a Flag of values as New and Existing.
I tried below in the script. I tried to compare the customer_id with previous customer_id, if it matches, then it should be 'Existing', If it doesnot matches then it should be new Customer_id. I took this flag in front end but its not working. For both existing and New values there are no matching customer_id's shown.
processed_xp_customer_master: LOAD customer_id, customer_enrolled_on, customer_enrolled_on & customer_id as key
load customer_enrolled_on & customer_id as key, if((customer_id)=Previous(customer_id),'Existing Customer', 'New customer') as customer_id_flag Resident processed_xp_customer_master Order by customer_enrolled_on, customer_id ;
I have ordered it by customers enrollment date and customer_id.
Try it with a change within the ordered fields - means at first to sort for the customer_id and then for the enrolled-values (the order in which the fields are listed in the order by statement is important).
Add a recno() and a rowno() to the load to see which record is ordered in which way. If it didn't worked like expected it could be caused through the fact that your fields aren't numeric or they might be also a dual() value and the numeric value is here different to the string-part.