I've been trying to figure out how to cogroup for a long time, and I can never seem to get it to work. The code below should just give two numbers, one from each dataset. My end goal would be to subtract one from the other, but I can't seem to do that using cogroup because I always receive the Unknown IDTOKEN error. Any suggestions?
q = load "Opportunities_Sales_Ops"; q = group q by all; q = foreach q generate sum('Total_MRR__c') as 'B'; p = foreach q generate 'B', 'B'*0 as 'zero'; q = load "ServiceOrders_JL"; q = group q by all; q = foreach q generate sum('Total_MRR__c') as 'A'; q = foreach q generate 'A', 'A'*0 as 'zero'; z = cogroup p by 'zero', q by 'zero'; z = foreach z generate p.'B' as 'Gross Sales', q.'A' as 'Cancelled Sales', q.'B'-p.'A' as 'Net Sales';
I receive the error "Unknown IDTOKEN: B", but I've very clearly created B above. Can anyone provide some suggestions?