English

Error: Unsorted or corrupt turntable

Error Message

This error occurs after adding records to previously declared turntable:

"Unsorted or corrupt turntable"

Cause

The turntable VTab is not sorted.

Solution or Workaround

The following script will create a new sorted VTab that can then be declared as the turntable.

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.


  2. Paste the following code into the new window.

    Code:
    '-- This script performs a permanent sort on a VTab.

    atable = av.getactivedoc
    avtab = atable.getvtab

    tempname = av.getproject.makefilename("sorted","dbf")
    newFileName = FileDialog.Put (tempname, "*.dbf", "Choose output table name")
    if(newFileName = nil) then return nil end
    anewvtab = vtab.Makenew(newFileName, dbase)
    anewtable = table.make(anewvtab)
    anewtable.setname(newFileName.getname)

    afieldlist = avtab.getfields
    sortfield = msgbox.choiceasstring(afieldlist, "Please select the 'NODE' field:", "Node Field")
    atable.sort(sortfield, false)
    avalue = nil

    anewvtab.seteditable(true)

    otherfieldlist = afieldlist.clone
    for each f in otherfieldlist
    anewvtab.addfields({f.clone})
    end

    for each rec in avtab
    newrec = anewvtab.addrecord
    for each x in otherfieldlist
    arecordnumber = atable.convertrowtorecord(rec)
    z = avtab.returnvalue(x,arecordnumber)
    anewvtab.setvalue(anewvtab.findfield(x.getalias),rec,z)
    end
    end

    anewvtab.seteditable(false)
    anewtable.getwin.open

  3. Select Compile from the Script menu or click the
    [O-Image] Script compile button
    button.
  4. Make the unsorted table active and click the script window.
  5. Click the
    [O-Image] Run compiled script button
    button to run the script.
  6. Declare the new table, created by the script, as the turntable.