I'm struggling with an insert into statement inside a For Each Row iteration. I want to look up a category from the column "Type" and based on that select the value in the column "COLUMN_NAME" to form a list for each category. I think I'm failing with the Insert Into
// Get the current data table
dt = Current Data Table();
colName = "Type";
// Get the column reference
Types = Column( colName );
// Extract all values from the column
allValues = Types << Get Values;
// Get unique values (removes duplicates)
Cats = Associative Array( allValues ) << Get Keys;
// Sort the unique values (optional)
Cats = Sort List( Cats );
// Display results in the log
Show( Cats );
delCats = {"", "-"};
For( i = 1, i <= N Items( delCats ), i++,
Remove From( Cats, As List( Loc( Cats, delCats[i] ) ) )
);
show(Cats);
For For( i = 1, i <= N Items( Cats ), i++,
Spud = Char(Cats(i));
Spud = {};
For Each Row(
// Access column values directly by name
If(:Type = Char(Cats[i]), Insert Into(Spud, :COLUMN_NAME) ;
);
));
statement.