Trying to make a basicreport available on several indexes, but it seems its impossible to change the index at runtime.

For instance:

Code:
         Property Integer piIndex
        
         Set Server to oTransac_DD  

        If (piIndex(Self)=6) Begin 
            Report_index by 6
        End
        Else Begin 
            Report_index by 5
        End
always runs on index 5

I found the command definition both in report.pkg and creport.pkg but my knowledge of FMAC isn't strong enough to say why the command couldn't be issued more than once. Obviously the workaround is either two reports or an intermediate file, but is there some other way to be able to cycle between indexes

Code:
//
//  Set a Reports Index and direction
//     Format is: REPORT_INDEX BY|DOWN Index#|File.Field
//
#COMMAND Report_Index "BY""DOWN" R . // Set piOrdering property
  #IFSAME !1 DOWN
    Set pbFindDown to True
  #ELSE
    Set pbFindDown to False
  #ENDIF
  #IFCLASS !2 "F"     // if File.Field then figure out which
    #PUSH !i          // index number to use at run-time
    #PUSH !l
    #SET L$ !2        // get file#
    #SET I$ %!2       // get field# -- aha-new undocumented features
    Set piOrdering to (Which_Index(self,!l,!i))
    #POP L$
    #POP I$
  #ELSE
    Set piOrdering to !2 // if Index.# or # set piOrdering at compile-time
  #ENDIF
#ENDCOMMAND