property pKWToRecNum -- all keyword combinations as properties; a list of associated recNumbers as values
property pKWtoKWP -- property list. Props are single keywords, their values are all keyword pairs associated with them
property pKWToRecList -- property list. Props are single keywords, their values are all records associated with them (via various kwps)
property pNumOfRecords -- count of pRecNumToKW (the number of records)
property pNumOfKWPairs -- the number of keyword pairs used
property pKWPairHits -- property list; properties are the used keyword combinations; values are integer counters, which default to 0
----------------------------- it also serves as an indicator of whether a KW combination has been visited yet
property pKWHits -- this list is used to reshuffle the list 'pKWPSortOrder' according to user preferences;
property pKWPSortOrder -- this list contains the keyword pairs in their sort order, which updates every time the user makes a selection
property pRecordStatus -- keeps track of each record, and whether they are visited or not visited (#vtd, #utd)
property pRecordNumbers -- contains a simple list of recorsd numbers so it can be double-checked whether a record number is legal
property pIllegalRecords -- contains list of illegal records - gets built up during running of programme and gets saved to file as "illegalrecords.txt" in the debug folder
on new me, updateMode
addObject me
-- this list is good unless new keywords are added or keyword names are changed
-- creating pKWHits, which tracks how often a particular keyword has been hit -
-- this doesn't get saved to disk, it needs to be copied and pasted from the message window into this script
pKWHits = [:]
numofEntries = pKWCodeToKWName.count
repeat with n = 1 to numofEntries
pKWHits.addProp(pKWCodeToKWName.getPropAt(n), 0)
end repeat
-- creating pKWtoKWP, which is a list in the following format: ["k01": [["k01", "k02"], ["k01", "k07"], ["k01", "k30"], ["k01", "k31"], ["k01", "k34"] etc
-- i.e. all keywords are properties, and the values associated with them are list of all existing key word pair combinations
-- datascreen uses this list to double check display requests - there may always be a record request which is qctually illegal.
-- this list contains all legal records
pRecordNumbers = []
repeat with pointer = 1 to pNumOfRecords
thisRecord = pRecordStatus.getPropAt(pointer)
pRecordNumbers.add(thisRecord)
end repeat
-- put "pRecordNumbers" && pRecordNumbers
end
on recordNumIsLegal me, recordNum
return pRecordNumbers.findPos(recordNum)
end
-- recordNumListIsLegal
on legaliseRecNumList me, listOfRecs
-- startTimer
numOfRecs = listOfRecs.count
thisCulpritList = []
retVal = listOfRecs
repeat with n = 1 to numOfRecs
thisRec = listOfRecs[n]
if not recordNumIsLegal (me, thisRec) then thisCulpritList.add(thisRec)
end repeat
numOfCultprits = thisCulpritList.count
repeat with curCulprit in thisCulpritList
if not findPos(pIllegalRecords, curCulprit) then
pIllegalRecords.add(curCulprit)
end if
-- put "curCulprit" && curCulprit
repeat while retVal.findPos(curCulprit)
deleteOne retVal, curCulprit
end repeat
end repeat
-- put "thisCulpritList" && thisCulpritList
-- put "the timer" && the timer
-- if thisCulpritList.count then customAlert "There are" && string(numOfCultprits) && "illegal record numbers in the current list of requested records"& return & "Culprits: " && string(thisCulpritList)
-- if thisCulpritList.count then put string(numOfCultprits) && "illegal records" & return & "Culprits: " && string(thisCulpritList)
return retVal
end
on kwpLstToKWPStr me, KWPLst
-- turns a keyword list into a keyword string as used in pKWToRecNum and pKWPairHits
-- i.e. put kwpLstToKWPStr(oDataBase, ["k01", "k78"]) results in "0178"
if listP(KWPLst) then return KWPLst[1].char[2..3] & KWPLst[2].char[2..3]
else return KWPLst
end
on KWPStrToKWPLst me, KWPstr
-- turns a keyword list into a keyword string as used in pKWToRecNum and pKWPairHits
-- i.e. put kwpLstToKWPStr(oDataBase, ["k01", "k78"]) results in "0178"