Ok here we go!
Here is my workaround to make slow Magic Nodes fast. (Magic Nodes with advanced SQLFilters.)
The idea is to create an indexed table in Access as a substitute for the SQLFilter used in the Magic Node.
Example:
Here is a very slow Magic Node wich displays all tracks with the same Artist, Title and Length.
Code: Select all
DupsArtistTitleLenght|SQL filter: IDArtist&SongTitle&Format(SongLength/1000/86400,'hh:nn:ss') IN (SELECT IDArtist&SongTitle&Format(SongLength/1000/86400,'hh:nn:ss') FROM Songs GROUP BY IDArtist&SongTitle&Format(SongLength/1000/86400,'hh:nn:ss') HAVING Count(Songs.ID)>1)\<Artist>
If you instead base the SQLFilter on an Acces Table it would look like this:
Code: Select all
DupsArtistTitleLenght|SQL filter: songs.id in (select id from TABLENAME)\<Artist>
So how do we create such a table in access? Well it's somehow complicated but i'll try to explain. (I assume you know how access works so I will not write any exact step by step instructions.)
1. First create a select query by pasting this code into the sql view of an Access query:
Code: Select all
SELECT Songs.IDArtist, Songs.SongTitle, Format([SongLength]/1000/86400,"hh:nn:ss") AS Length
FROM Songs
GROUP BY Songs.IDArtist, Songs.SongTitle, Format([SongLength]/1000/86400,"hh:nn:ss")
HAVING (((Count(Songs.ID))>1));
Save it as SamArtTitLen1
2. Create a "make table" query from this code:
Code: Select all
SELECT Songs.ID INTO SamArtTitLen
FROM Songs INNER JOIN SamArtTitLen1 ON (Songs.SongTitle = SamArtTitLen1.SongTitle) AND (Songs.IDArtist = SamArtTitLen1.IDArtist)
WHERE (((Format([SongLength]/1000/86400,"hh:nn:ss"))=[Length]))
GROUP BY Songs.ID;
Save it as SamArtTitLen3
3. Run the make table query (SamArtTitLen3). Close it and open up the newly created SamArtTitLen table in design view and add a key to the ID field.
4. Open the SamArtTitLen3 query in design view and change the query type to Append query.
5. Create a new delete query from this code:
Code: Select all
DELETE SamArtTitLen.ID
FROM SamArtTitLen;
Save it as SamArtTitLen2
Now you will have three queries:
- SamArtTitLen1, which is nested into SamArtTitLen3
- SamArtTitLen2, which deletes all data in table SamArtTitLen
- SamArtTitLen3, which adds new data to table SamArtTitLen
And one new table:
- SamArtTitLen, which is indexed on field ID
(The reason for having one delete and one add query is that we want to keep the key in the table SamArtTitLen which wouldnt be the case if we only used one make table query instead.)
Create a new Magic Node:
Code: Select all
DupsArtistTitleLenght|SQL filter: songs.id in (select id from SamArtTitLen)\<Artist>
This Magic Node is fast!
The downside is that you MUST run the SamArtTitLen2 and SamArtTitLen3 queries everytime you change or add tracks to MM.
This could however be simplified by creating an Access Macro:
- SetWarnings = no
- OpenQuery SamArtTitLen2
- OpenQuery SamArtTitLen3
Save it as MacroSamArtTitLen
The macro is executed in 3 sec!
This method could be used on some really advanced Magic Nodes which would have been impossible on large collections. Due to too long execute time.
Eg:
- Display all "Duplicate content" without those marked with OK in custom3
- Display all tracks with same Artist, title and (lenght+-3 sec)
- Display all tracks with partial match on artist and title
- Etc..
Let me know what you think of this and what you want. I'll try to help out if I can.
Enjoy!
PS If it is possible to run macros or action queries in Access from a script then this method is really something to explore. Anyone knows?