Hello Smu, I would suggest using Folder function. In my env, I have same results for both cases. What is the difference in your environment?
If you look at the attribute definition for I_cabinet_id - Object ID of the cabinet that is the object’s primary storage location. This means that if a document is linked to multiple cabinets, it will only have I_cabinet_id of the primary location. Using I_cabinet_id of other cabinets will not return the document even though its linked there.
However, using Folder ('/Temp', descend) will pull back any object linked in Temp cabinet (and below) regardless if the object is linked to multiple locations. This explains the discrepancy.
Hi Smu,
I think in the dql with FOLDER , the result includes document links, but in the other if your original link isn't in the same cabinet the i_cabinet_id is different, so you have less results. So, if you need all the documents linked in a cabinet included document as links, you need to use the FOLDER query.
Regards,
Jeza
Not sure why, but I use FOLDER() all the time if you want to query against a specific cabinet/folder
@DCTM_Guru answered correctly.
If you compare generated SQL queries for both cases, you will see difference.
Folder() uses i_ancestor_id='0c...' (The object ID of the folders or cabinets that contain this folder directly or indirectly). This means it will find all dm_folders in that cabinet '0c...' (or folder, depending on 1st argument path), and then it will return all dm_document objects wither r_object_id value of those dm_folders exists in dm_document.i_folder_id attribute. i_folder_id - Object IDs of all folders linked to the object
i_cabinet_id - Object ID of the cabinet that is the object’s primary storage location. So you would get less results.
Why are you using (all) - are you trying to get count of ALL versions of the document? Most people only care about current version (without all) if you are doing just a count. Something to keep in mind is that if you move a document, only the current version gets moved to new location. All previous versions will stay in the previous location, so your query may not presenting the desired results.
You have all of my concerns about your query.
@Srnu said: I am doing a volumetric analysis for migration to SharePoint so I need the count of all the documents in a cabinet
In this case you just need use same DQL condition as for migration. If you will calculate all dm_document versions count, but migrate current versions only, so calculation will be incorrect and useless. In other words it depends on migration, just use same DQL condition as for migration process.