Indexing Causes Problems

Lists lists at jskump.com
Wed May 28 17:03:43 CDT 2003


Hi List,

I don't use Valentina very much, so forgive my ignorance. I searched the
archives but could not find anything that was exactly the same as my
problem.

Mac OS 9.2, Valentina PPC 1.9, G4 450

I have two base objects: Dealers and Listings.

I import a text file of listings. I then need to update the DealerPTR. When
the update of the DealerPTR record in the Listings base object occurs,
Valentina attempts to index the DealerPTR field. A small dlalog appears with
a spinning progress bar that says "Indexing:Listings:DealerPTR" and it NEVER
stops. If I click Cancel, Valentina quits with a type 2 error.

Any ideas?

One question is why I have to use the PTR field in the first place. This
doesn't really make sense to me. I am using a unique ID for each dealer that
is contained in the Dealer's many listing records. In other RDBMS, I could
create a relationship on this field and everything would work. But not with
Valentina. My KeyFields are useless as I seem to have to use the PTR field
for joins. Maybe I am doing something wrong?

I am using AppleScript. I've indicated below where the error occurs. Here is
the code:


tell application "Valentina PPC"
    set DB to database "Driving"
    set Listings to base object "Listings" of DB
    set Dealers to base object "Dealers" of DB
    
    set theFile to file "Macintosh HD:Desktop Folder:inventory.txt"
    
    tell base object "Listings" of database "Driving"
        import from ascii file theFile to {field "field1", field "field2"}
    end tell
   
--update the dealer pointer records
    
    tell database "Driving"
        set theCursor to SQL Select "SELECT RecID,* FROM Dealers"
        set theCount to count of records of theCursor
    end tell
    
    repeat with i from 1 to theCount
        set current record of Dealers to record id i of Dealers
        set position of theCursor to i
        set theDealerID to field "DealerID" of theCursor
        set theDealerName to field "DealerName" of theCursor
        set theDealerRecID to field "RecID" of theCursor
        
        set ResultSet to (select records of Listings where {field "DealerID"
of Listings, theDealerID})
        set theListingCount to (count of records of ResultSet)
        
        tell Listings
            set field "DealerPTR" to record id i of Dealers
            



        -- ***** The following line is where the problem occurs
        replace value for field "DealerPTR" in ResultSet
        end tell
        delete ResultSet -- free memory
        
    end repeat
    
    delete theCursor
    
end tell



More information about the Valentina mailing list