Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006
    Posts
    157

    Unanswered: Multidimensional Array Comparison

    Hey Guys,

    Just asking around for some opinion on how i might be able to do this better :

    case : 2 multidime arrays
    - need to compare, determine differences on same numbered rows, determine which were added or deleted

    - data eg.

    array 1 : key : 0 ; field1 : a ; field2 : 1 --> this is the original array
    key : 3 ; field1 : a ; field2 : 2
    key : 4 ; field1 : c ; field2 : 2
    key : 5 ; field1 : b ; field2 : 3

    array 2 : key : 1 ; field1 : c; field2 : 2 --> this is the modified array
    key : 2 ; field1 : a; field2 : 3
    key : 3 ; field1 : a; field2 : 2
    key : 4 ; field1 : b; field2 : 2
    key : 5 ; field1 : c; field2 : 1

    both being input to a function

    from here i'm supposed to come up with an array reporting that
    row with key = 0 has been deleted
    row with key = 1 and row with key = 2 have been added
    ( no entry need be created for row with key = 3 because no change was made for that key )
    row with key = 4 changed with field1 changed from c to b
    row with key = 5 changed with field 1 changed form b to c and field2 changed
    and field2 changed from 3 to 1


    currently i'm doing this

    oldctr = 1; newctr = 1;

    loop through old array,

    for each pass: loop through new array and compare key,
    on matched key, compare fields - if variance detected do
    entry on report - mark this row for both arrays as tested

    on final pass if no match was found report key to be deleted

    end of testing old array,

    loop through elements of new array that weren't tested
    and mark them as newly created...



    sorry this seems quite long... but if anyone could provide some time
    Only quitters quit!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Homework??
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Apr 2006
    Posts
    157
    nope , ongoing project,

    and i think i'm just pulling an insane stunt, playing with eav structured schema
    Only quitters quit!

Posting Permissions

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