[quote=“Torben, post:11, topic:7259”]If an internal ID is specified, mAirList will try to identify the track by the internal ID. Otherwise, mAirList will try to identify the track by either its external ID or the filename.
So, for example, when you want to set the external IDs of a number of files, create a CSV file where the first column is empty (will force mAirList to use the file name for identification)[/quote]
Which of the two statements is correct? If it is the first one (which seems likely), then it may not be possible to change an existing External ID in mAirListDB for records which HAVE an existing External ID; in which case, the second statement (will force mAirList to use the file name for identification) cannot be true for all cases.
In other words, if a different item in mAirListDB now has the External ID which was previously used by another pre-existing item (it could happen!), then mAirList will match to the wrong item, because the External IDs match, correct? And this could happen (depending on how it is done internally) while processing a CSV file.
If all that is correct, then better import logic would be:
- Does Internal ID match? If so, process CSV record and exit.
- Does External ID match? If not, go to step 4.
- Does file path/name match? If so, process CSV record and exit.
- Does file path/name match? If so, process CSV record.
which simplifies to:
- Does Internal ID match? If so, process CSV record and exit.
- Does file path/name match? If so, process CSV record.
… because we just proved that a match on External ID is irrelevant to the logic and thus unnecessary. Even if the External ID matches, you also need to match on file path/name to be certain that you are updating the correct mAirListDB row.
If you are now thinking, ‘what if there’s an matching External ID but no filename?’ then you are correct: nothing will hapen using the logic above. We do need to add one further test:
- Does Internal ID match? If so, process CSV record and exit.
- Does file path/name match? If so, process CSV record.
- Is file/path name = ‘-’ AND External ID matches? If so, process CSV record.
Step 3 above assumes that the user wants to change some field(s) other than the file path/name, and we just have to trust the user to be using the correct External ID values. 
So in short, the order of precedence for matching should be:
- internal ID,
- file/path name
- external ID (only tested if file/path name is ‘-’ == ‘leave intact’).
Changing the order (if this is not currently how it works) WOULD allow you to change the External ID of any item in mAirListDB after it has been assigned. This may be necessary if the external database has been exported/imported or rebuilt.
BFN
CAD