photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: ubacher on July 14, 2017, 01:12:42 PM

Title: IMatch.selectedFolders selects all files in db - bug?
Post by: ubacher on July 14, 2017, 01:12:42 PM
I tried getting the files in the selected folders using this code:
Quotefunction getAllFiles() {
                IMWS.get('v1/files', {
                    idlist: IMatch.selectedFolders,
                    fields: 'id,filename,name,namene,ext'
                }).then(function (response) {
                    allfiles = response.files;
                    console.log(JSON.stringify(response, null, 2))
.......
                   
This returns all the files in the db. The selected folder has only 23 files. Am I doing something wrong?
Title: Re: IMatch.selectedFolders selects all files in db - bug?
Post by: Mario on July 14, 2017, 03:34:03 PM
idlist: IMatch.selectedFolders,

is wrong. This idlist does not exist. And as a fallback IMatch returns all files.
Look carefully at the name. and then check again in the documentation of the IMatch class.
Title: Re: IMatch.selectedFolders selects all files in db - bug?
Post by: ubacher on July 14, 2017, 06:57:55 PM
I find in Imatchlib.js:

   selectedFolders : '@imatch.selectedFolders',

I tried IMatch.idlist.focusedFiles, / and also '@imatch.selectedFolders',
Title: Re: IMatch.selectedFolders selects all files in db - bug?
Post by: Mario on July 14, 2017, 07:29:05 PM
It is always IMatch.idlist...
I will analyze this over the weekend. IMatch.idlist.selectedFolders should work for the folders/files endpoint, but not for /files.
/files expects a list of file ids, not folder ids.