Donwload multiple documents from multiple BOs

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Donwload multiple documents from multiple BOs

Post by srufini »

Hello,

I would like to download the document attribute of many BO as result of a quey

this is the process code:

RULE1: PICK FROM Milestones

RULE 2:
FIND Deliverables WHERE Deliverables.Milestone=ThisAppointment
DOWNLOAD DOCUMENT Deliverables.Doc_Version.PDF

but it downloads only one PDF document.
I tried using OtherDeliverables.Doc_Version.PDF without success, still just one.
I also try to move the command DOWNLOAD DOCUMENT to another subprocess, but no success as well.

How can I feed the DOWN DOC with all the result of my query? It woul dhave been nice to use FOR EACH but is not applicable.

somebody mentioned also creating a zip file first, but I understood you need a plugin and I would like to avoid that path for now.

Thanks

Sergio
kklosson
Posts: 1668
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Donwload multiple documents from multiple BOs

Post by kklosson »

Use the test log to see how many items are found in the query.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

kklosson wrote: Thu Dec 12, 2024 10:40 pm Use the test log to see how many items are found in the query.
Hi kklosson,

many thanks for the quick reply!

I used the debugger and the test log and I can confirm all the results of the query are put in context:

I have 4 results in my query.
In the debugger I can see that:
1 result goes to ThisDeliverable
1 result goes to ThatDeliverable
last 2 results are assigned to OtherDeliverable

so they are in the context but the command DOWNLOAD DOCUMENT is exectuted only on one.

cheers

Sergio
aware_support
Posts: 7575
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Donwload multiple documents from multiple BOs

Post by aware_support »

Hard to say without knowing what's in your document and what you want to achieve.

However, you can merge PDF documents in one - check out the DISPLAY DOCUMENT action in the Rule Language Guide. You should find an option to merge documents. Maybe it can be a solution to your problem.
Aware IM Support Team
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

Hi,

documents are PDF files only. I want the user to to download them all at once as separate files on the user computer.

Unfortunately, merging them is not a solution for me.

I tried a simplier approach:

I created a process DownloadDataPackage with only one line

DOWNLOAD DOCUMENT Doc_Version.PDF

The in the user Query of deliverable I let manually select the user the deliverables that I want to download and added in Top Bar a start process command with multiple selection and call to process DownloadDataPackage.

It should have been starightforward, but unfortunately still only one document pdf is downloaded.


It is a limitation in the DOWNLOAD DOCUMENT command ? (DISPLAY DOCUMENT also open just one window).


Cheers

Sergio
aware_admin
Site Admin
Posts: 67
Joined: Sun Jan 02, 2005 4:36 am
Contact:

Re: Donwload multiple documents from multiple BOs

Post by aware_admin »

What if for the sake of experiment, you create a process with several DISPLAY DOCUMENT actions = one after the other.

DISPLAY DOCUMENT ...
DISPLAY DOCUMENT ...
...

This should work in theory. If it does, maybe you can somehow use it - for example, if each DISPLAY DOCUMENT can be associated with a condition you could have something like:
IF Condition1 Holds
DISPLAY DOCUMENT ...
IF Condition2 Holds
DISPLAY DOCUMENT ...

etc
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

Hi,

I did use a;ready
DOWNLOAD DOCUMENT ThisDeliverable....
DOWNLOAD DOCUMENT ThatDeliverable...
DOWNLOAD DOCUMENT OtherDeliverable...

and it worked but only 3 times. Being result on 4 BO, and 2 are "Other" ( confirmed in the debugger) I was hoping that last DOWNLOAD would run 2 times.

You suggest I should use a counter of query result and decrease for each iteration of the IF cycle?

Moreover, I tried EXPORT DOCUMENT, this works on many documents at the same time, unfortunately is saves them on the server drive (no workaround, right?)

Cheers

Sergio
aware_admin
Site Admin
Posts: 67
Joined: Sun Jan 02, 2005 4:36 am
Contact:

Re: Donwload multiple documents from multiple BOs

Post by aware_admin »

A workaround with EXPORT may work. Yes, it exports to the server drive only, but you can export into the web application folder or a sub-folder, where these files become accessible by the browser. So then they can be downloaded to the client by a Javascript that can run at the end of the process
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

ok,

the path seems clear, even if it seems cannot be solved in the zero-code fashion.
i don't have javascript capabilities for now (waiting for an extra colleague to help for this but will take some months).
I believe the best approach is to download in a temp folder of the server and create a zip file.
Then use DISPLAY DOCUMENT xxx.zip to download the zip.

I saw this mentioned in the forum several times, but not sure how to implement.
Is there a guide/how to on how to use 7zip to compress a folder via AwareIm command ?

Thanks

Sergio
kklosson
Posts: 1668
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Donwload multiple documents from multiple BOs

Post by kklosson »

Can you configure a report rather than a document?
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

no, these are attachment files from different sources.
aware_support
Posts: 7575
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Donwload multiple documents from multiple BOs

Post by aware_support »

If you know the command line of the zip tool you can use the EXECUTE action to execute it. I

We will make a note to either allow downloading multiple documents or add a zipper command to our list of actions.
Aware IM Support Team
srufini
Posts: 40
Joined: Thu May 23, 2019 11:23 pm

Re: Donwload multiple documents from multiple BOs

Post by srufini »

Thanks support,

that will be very useful, not only for me I believe.

In the meantime I managed to make it work.
HERE MY SOLUTION FOR THE RECORDS:

I installed the 7-zip on the server
Added in the PATH enviromental Variable of windows the path of the installation folder of 7-zip
Created the Process (using Session variables for the path and filename) with following rules:

Code: Select all

RULE 1:
MySession.TempPath=SystemSettings.RepositoryPath+'temp\'+REPLACE_PATTERN(ThisAppointment.Subject, ' ', '_')+'\'
MySession.TempFileName=SystemSettings.RepositoryPath+'temp\'+REPLACE_PATTERN(ThisAppointment.Subject, ' ', '_')+'\'+REPLACE_PATTERN(ThisAppointment.Subject, ' ', '_')+'_'+AS_STRING(CURRENT_DATE)+'.7z'
RULE 2:
EXECUTE PROGRAM '7z a '+MySession.TempFileName+' '+MySession.TempPath
RULE 3:
IMPORT DOCUMENT MySession.tempfile FROM MySession.TempFileName
DISPLAY DOCUMENT MySession.tempfile IN WINDOW
RULE 4:
DELETE FILE MySession.TempPath
DELETE MySession.TempFileName
DELETE MySession.tempfile
IMPORTANT!: z-zip will mess around if there are spaces in the file path or file name, so I had to substitute them with underscore.


Cheers

Sergio
Post Reply