Transform a recordset array (pivot)

Results 1 to 2 of 2

Thread: Transform a recordset array (pivot)

  1. #1
    Join Date
    Dec 1969

    Default Transform a recordset array (pivot)

    When i use the GETROWS method of a recordset i get an array like this:<BR><BR>MYARR = rs.getrows<BR><BR>this array can look like this:<BR><BR> Activity period Hours<BR> running 2001.01 15<BR> running 2001.02 20<BR> skiing 2001.01 5<BR> skiing 2001.01 10........<BR><BR>but what i want is call a VBscript routine that is dynamic and transform<BR>this array into a new array(s?):<BR><BR>activity 2001.01 2001.02<BR>running 15 20<BR>skiing 5 10.........<BR><BR><BR>(This is called a pivot array i think)<BR><BR>Does anybody have a code snippet that can do this?<BR><BR>thanks<BR>Jan Erik Hansen<BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default It's all in the access

    you don&#039;t actually need to transform the array just change your code on how you access elements of the array<BR><BR>eg array(2,3)<BR>a, b , c, d<BR>1, 3, 5, 7<BR>2, 4, 6, 8<BR><BR>Normally get values by doing<BR><BR>For i = 0 to 2<BR> For j = 0 to 3<BR> Response.Write arr(i,j)<BR> Next<BR>Next<BR><BR>Instead do<BR>For j = 0 to 3<BR> For i = 0 to 2<BR> Response.Write arr(i,j)<BR> next<BR>Next <BR> <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts