Forum Discussion
Hi,
getItemById is not intended to be used with additional filter properties. It´s a simply way to make a get query that returns the complete item. I personally prefer the regular get queries due to performance reasons.
When you want to add an additional filter, make a normal get, e.g. like:
var filteItem = inn.newItem("File","get");
[...your additional code...]
- Jenli5 years agoCreator I
Hi Angelalp,
I did updated the a piece of code as you suggested, using regular get queries instead of getItemById.
it looks fine until the code runs to the red line I marked which downloading files as Zip file then shows the same error again. Is that "fileItem" should not be a item object or something else? Appreciate it.
- angela5 years agoCatalyst II
Hi Jenli,
my tip was not completely correct.
aras.downloadFile always require the full item, so according to my knowledge, you may have to use it with getItemById. I never used in another way, e.g. this one is my variant (custom properties).
var fileItem = aras.getItemById("File", dom.firstChild.getAttribute("id"));
aras.downloadFile(fileItem, zipFileName + ".zip");Does downloading the zip file work when you just the sample "as is"? I wonder why you wanted to add the "locked_by_id" filter. "File" items are normally not locked/unlocked.
The downloadFile function will download you the final zip result. Each filter you want to add you have to provide before so the used id list for the involved Files is correct.When you use one of the newer Innovator Versions (late Innovator 11 or Innovator 12) I would also recommend to remove all "top." prefixes. You will not need them and sometimes they can lead to trouble.
- Jenli5 years agoCreator I
Hey Angelalp,
the code should works.
var fileItem = aras.getItemById("File", dom.firstChild.getAttribute("id"));
aras.downloadFile(fileItem, zipFileName + ".zip");What I am trying to do is locking the file before downloading it, so the other users will not download it until the I upload this file is done. If like you said the " File " Item is no that kind of locked/unlocked properties, so any suggestions that how to blcok others from downloading action if there is already has a user just did download action and not done with the upload? Thanks very much Angelalp.