Example BSV: Exporting files to the file system

Contains tips for configurators working with Aware IM
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Example BSV: Exporting files to the file system

Post by tford »

This BSV will demonstrate:
1) Exporting a document to the file system
2) Tracking the exported file name / path
3) Ability to delete a tracked file from the file system
4) Display the document using
....a) DISPLAY URL
....b) HTML link on Form

Download BSV here
Remove .bin extension after download


1) When you first run the BSV, click "System Settings for Docs". Default values for folders will appear as follows:
Image



2) Upload Documents. Note that the target folder will be automatically created by AwareIM if it does not exist.

Image



3) When you click "View Stored Docs", this Visual Perspective appears:

Image


4) This Form is show how a stored document can be opened via HTML cell link.

Image
Tom - V8.8 build 3137 - MySql / PostGres
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Thanks

Post by [email protected] »

Thanks for the sample Tom. One other question - how do you manage the size of the directory? I would think having thousands of documents in one folder could be an issue with retrieving.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

how do you manage the size of the directory?
Have not had that issue. You could easily have multiple directories though.

Also, you need to make a copy of this directory when installing a new version of AwareIM... otherwise it will be written over.
Tom - V8.8 build 3137 - MySql / PostGres
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

UNC

Post by [email protected] »

Have you tried using a UNC path and hosting the files on a different server?
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

No.... please let use know your experience if you try it.
Tom - V8.8 build 3137 - MySql / PostGres
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

condition

Post by [email protected] »

What does the condition 1=0 mean?

If 1=0 Then
EXPORT DOCUMENT LoggedInRegularUser.Doc1 TO FILE SystemSettings.ExportPath_MyDocs+FILE_NAME(LoggedInRegularUser.Doc1)+'.'+FILE_EXTENSION(LoggedInRegularUser.Doc1)
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

I should have deleted that before posting the BSV.

It's just a way of making a line of code / rule not fire since 1=0 will never be true.
Tom - V8.8 build 3137 - MySql / PostGres
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Another Question

Post by [email protected] »

Your example is very cool. I see some issues as it relates to my needs. There is going to be many times when the same file name will exist. We allow for Email messages and various other "documents" that all could have the same name. Using the SQL solution, I didn't have to worry about the same name being used.

I see that you check for existence of a file. This won't work for my application because the file that exists may not be related to the file were trying to place into the directory. I realize I could rename the files on export. If I go this route then I need a solution for renaming the file on display so that it accurately reflects the original document/filename. If I don't use the fileexists logic and just let it place the file into the directory, the file gets appended with a number. This works, but the problem is I don't know what the name of the file is. So, if there are three pitt.bmp files. The export would create pitt.bmp, pitt0.bmp and pitt1.bmp.

Any other ideas?
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Could you append the file name with a timestamp?
Tom - V8.8 build 3137 - MySql / PostGres
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Sure

Post by [email protected] »

Yes, I could do that, but it just will open when I display the file with that information included. Not really what I want the user to see.

The way I am structured is this:

Order_Header (BO)
Contact (BO)
Contact_Activity (BO)

All 3 objects use Attachments for storing documents. I think if I use a directory structure like below it would give me enough uniqueness. So, this would basically say that you can't have the same filename at Parent BO Name/BO.ID level which I think kind of matches a traditional windows directory structure if I were organizing the above objects:

Parent BO Name/BO.ID/filename

Also, I tried using UNC path. It was a no go.
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Theory

Post by [email protected] »

Well it won't work by creating directories on the fly because AwareIM won't create directories more then 1 level deep. Yikes.
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

UNC

Post by NBDAB »

Robert, If you do find a working solution with

1) Creating custom directories
or
2) Export to a UNC path

Let us know
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Ok

Post by [email protected] »

Will do. For right now, we are going to load the attachments into SQL until the directory creation within AwareIm is more robust.
jamesbh

Post by jamesbh »

Can AIM do multilevel directory creation in the current version?
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Yes, there are functions to do this. Check the User Guide.
Aware IM Support Team
Post Reply