Support Questions
Find answers, ask questions, and share your expertise

Unable to open iterator for alias topChange

New Contributor

I get an error when i tried to order by new column i created called change ive also tried to group an order still doesnt work.

pls any help will be apreciated

B = FOREACH group_population{
DA = ORDER population BY Year DESC;
DB = LIMIT DA 1;
DA = ORDER population BY Year ASC;
DC = LIMIT DA 1;
GENERATE group AS City, FLATTEN(DB.Year) AS lastYear, SUM(DB.Value) AS lastValue,FLATTEN(DC.Year) AS firstYear, SUM(DC.Value) AS firstValue;
};

B = FILTER B BY (lastYear > firstYear);

PopChange = FOREACH B {
Z = 100*(lastValue - firstValue) / firstValue;
Y = lastYear - firstYear;
GENERATE City, Z/Y AS change:int;
};

topChange = ORDER PopChange BY change DESC;
topChange = LIMIT topChange 10;

DUMP topChange;

0 REPLIES 0