To access field level data in a specific record, the recordset indexing capability must be used to select a single record. The SORT function and recordset filters are useful in selecting and ordering the recordset so that the appropriate record can be selected.
Example:
WorstCard := SORT(Cards,Std.Scoring); MyValue := EVALUATE(WorstCard[1],Std.Utilization); // WorstCard[1] uses indexing to get the first record // in the sort order, then evaluates that record // returning the Std.Utilization value ValidBalTrades := trades(ValidMoney(trades.trd_bal)); HighestBals := SORT(ValidBalTrades,-trades.trd_bal); Highest_HC := EVALUATE(HighestBals[1],trades.trd_hc); //return trd_hc field of the trade with the highest balance // could also be coded as (using indexing): // Highest_HC := HighestBals[1].trades.trd_hc; OUTPUT(Person,{per_last_name,per_first_name,Highest_HC}); //output that Highest_HC for each person //This output operates at the scope of the Person record // EVALUATE is needed to get the value from a Trades record // because Trades is a Child of Person IsValidInd := trades.trd_ind_code IN ['FM','RE']; IsMortgage := IsValidInd OR trades.trd_rate = 'G'; SortedTrades := SORT(trades(ValidDate(trades.trd_dopn),isMortgage), trades.trd_dopn_mos); CurrentRate := MAP(~EXISTS(SortedTrades) => ' ', EVALUATE(SortedTrades[1], trades.trd_rate)); OUTPUT(person,{CurrentRate});
See Also: SORT