algorithms for rows in reports pertaining to formulas

To Add a row x

for every row

{

For every reference rf

  {

    if rf >= x

      rf++

  }

}

for all rows x and greater

index ++

add row x

To Delete a Row x

for every row

{

For every reference rf

  {

    if rf > x+1

      rf--

    elsif rf == x

      rf = -1

  }

}

delete row x

for all rows x+1 and greater

index--

To move a row x to row y

{

  if x = y then exit

  elseif x > y

  {

    increment = -1;

    temp = y

    y = x

    x = temp

  }

  else

    increment = 1;

  for each row r

  {

    for each reference rf

    {

        if rf > x && rf < y

          rf + increment;

        elsif (rf == x)

          if (y >= r)

            error; return "";

          end if

          rf = y;

        elsif (rf == y)

          if (increment == 1)

            rf = x;

          else

            rf + increment;

          end if

        end if

    }

  }

  set row y index = -9

  set row x index = y

  for rows x+1 to y-1

    index + increment

  row index = -9 = y + increment

}


BACKUP Algorithm for move x to y NOT COMPLETE

To move a row x to row y

{

if x = y then exit

  for each row r

  {

    for each reference rf

    {

      if (x < y)

      {

        if rf > x && rf <= y

          rf--;

        elsif (rf == x)

          rf = y;

      }

      elsif (y < x)

      {

        if (rf < y && rf <= x)

          rf++

        elsif (rf == y)

          rf = x;

      }

      else Error!

    }

  }

}





Copyright (c) 2001 HLR
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1; A copy of the license is available at http://www.gnu.org/licenses/licenses.html#FDL.

Updated: $Id: reportrows.html,v 1.1.1.1 2001/08/09 19:02:58 moreejt Exp $