How to Apply Filters in Arrays

I have a report that i want to skip some Gen. Business Posting groups frm printing but am not able to achieve that using the codes have written below

Can someone look at them and advice. Thankx

Report - OnPrereport

FilterGBPGtoPrint := ‘COAST|EXPORT|MT KENYA|NAIROBI|NFD|NYANZA|N-RIFT|S-RIFT|WESTERN’; // FilterGBPGtoPrint is text of length 100

// Report shoud print what is provided by FilterGBPGtoPrint Filter as specified above. But instead its printing every thing.

GenFilters := “Inventory Posting Group”.GETFILTERS; // GenFilters is text of len 100

Inventory Posting Group - OnAfterGetRecord()

InvPostingGrpTotals := 0;
GenBusiPostingGroupTotals := 0;

// valueEntry references Value Entry table
valueEntry.RESET;
valueEntry.SETCURRENTKEY (“Item Ledger Entry Type”,“Gen. Bus. Posting Group”,“Inventory Posting Group”,“Posting Date”);
valueEntry.SETFILTER (valueEntry.“Item Ledger Entry Type”,‘Sale’);
valueEntry.SETRANGE (valueEntry.“Posting Date”,SalesDateFilter,SalesDateFilter1);
valueEntry.SETFILTER (valueEntry.“Inventory Posting Group”,“Inventory Posting Group”.Code);

//1 COAST |2 EXPORT |3 GENERAL |4 MT KENYA |5 NAIROBI |6 NFD |7 NYANZA |8 N-RIFT |9 R-VALLEY |10 S-RIFT |11 WESTERN
// Skip Printing Idx 3 and Idx 9

Idx := 1;
GenBusiPGroup[Idx].SETRANGE (GenBusiPGroup[Idx].Code,FilterGBPGtoPrint);
REPEAT
GBPG := GenBusiPGroup[Idx].Code;
InvPostingGrpAmount[Idx] := 0;
valueEntry.SETFILTER (valueEntry.“Gen. Bus. Posting Group”,GenBusiPGroup[Idx].Code);
IF valueEntry.FIND (’-’) THEN
REPEAT
InvPostingGrpAmount[Idx] += valueEntry.“Sales Amount (Actual)”;
UNTIL valueEntry.NEXT = 0;
GenBusiPostingGroupTotals += InvPostingGrpAmount[Idx];
InvPostingGrpTotals += InvPostingGrpAmount[Idx];
TotalValue[Idx] += InvPostingGrpAmount[Idx];
Idx += 1;
UNTIL GenBusiPGroup[Idx].Code =’’;

Idx := 1 ;

TotalForInventoryPostingGroupRow := 0 ;

GenBusPostingGroup.settange(Code, FilterGBPGtoPrint) ;

Repeat

valueentry.setrange( valueentry.“gen. bus. posting group”, genbuspostinggroup.code) ;

//create a sumindexfield for Sales Amount on the key you use above

valuenentry.calcsums( Sales Amount (Actual) ) ;

InvPostingGrpTotals[Idx] := valueentry.“sales amount (actual)” ;

Idx := Idx + 1 ;

//in my totalfields for this dataitem I would include InvPostingGrpTotals 1 - 11 and TotalForInventoryPostingGroupRow

TotalForInventoryPostingGroupRow += InvPostingGrpTotals[Idx] ;

Until GenBusPostingGroup.next = 0 ;