This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 11, 2014, 8:18 PM
7 Posts

Converting to Xpages; document attachment issues

  • Category: Debugging
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 8

Hi, all. We are in the process of "upgrading our Notes Domino intranet to one using Xpages. We have some existing documents that have attachments. We copied these documents, and their associated forms/views into a new application. After moving the forms/views onto Xpages, we are unable to view any sort of attachments at the document level. From the Xpage containing the view, we drill down to the document, and everything looks great.  Except for the fact that there is no indication that the attachments exist. We have used the File Upload and File Download controls to no avail. 

Can anyone shed light onto what we did wrong? Did we simply misuse the above mentioned controls?

As always, many thanks!

Aug 11, 2014, 8:45 PM
366 Posts
It depends if the attachments are...

attached to a field or to the document.

 

If they are attached to the document they will not be surfaced in the XPage as they will need to be "bound" to a field.

If they are attached to a rich text field then ensure that the correct RTF field is bound to the download control. (not always the "body" field)

Aug 11, 2014, 9:49 PM
7 Posts
Thanks, Paul

Thanks, Paul. In the original documents created from the Notes form, the attachments are bound to a RTF. On the Xpage, the File Download control is also bound - using the data choice under the properties eclipse view - to this field.  The attachments are still not showing up. 

It's as if the download control is unable to see any attachments. We clicked the box "hide if no attachments" (under the properties eclipse view, file download tab, in the options area). On a document with attachments, the download control was hidden.

Thanks again for your help!

Aug 12, 2014, 2:09 PM
586 Posts
hmm

I've really never used the built in file upload or download control in xpages.

when I had an app that I need to just show the attachments and allow for download / view, I built links to point to the attachments.  This post by Stephan was VERY helpful:  http://www.wissel.net/blog/d6plinks/SHWL-86QKNM

 

Recently I needed to allow for uploading attachments.  Again - I didn't want to use the built in stuff so I came up with what I'm calling "fileVault".  I have a demo of what it looks like here:  http://notesin9.com/index.php/2014/08/01/notesin9-150-announcing-filevault-for-xpages/

There are no build instructions yet...  I'm presenting it in a couple weeks and then the code and build info will hit NotesIn9.  So while that can't help you now maybe it can as soon as I can get it all posted.

Sorry I couldn't give better help to your specific issue.

 

Dave

Aug 13, 2014, 4:01 PM
7 Posts
fileVault

Thanks, David. Appreciate the response.  The teaser video worked; I am quite impressed and can't wait to see more of the fileVault feature.  It looks to be a viable solution to our problem.

Aug 13, 2014, 8:35 PM
7 Posts
Linking to attachment

Thanks, everyone, for the help so far. While David's fileVault is impressive, we are in need of a more immediate solution. Per Stephan’s post we are attempting to simply view an attachment using a URL. We are able to see the attachment in the document properties in the Notes client view under $FILE.  

Below is the actual URL and the resulting error.  Is the URL correctly formatted?

URL:

http://wc_notes/COUNTY/Budget.nsf/xsp/.ibmmodres/domino/OpenAttachment/Budget.nsf/1a43cc7d5b977b3e88257d2b0073640f/79e0c331fd58db5688257d2b006fb9cb/$FILE/FW%20Ceiling%20tile%20in%20CAO%20office.htm?open

Result:

404

Cannot load unregistered resource /domino/OpenAttachment/Budget.nsf/1a43cc7d5b977b3e88257d2b0073640f/79e0c331fd58db5688257d2b006fb9cb/$FILE/FW Ceiling tile in CAO office.htm

Aug 15, 2014, 1:40 AM
586 Posts
hmmm

I'm not exactly sure what's up with that URL...  I believe when trying to do this attachment to URL thing it's not really XPages at all.  It's a "classic domino" URL.

 

When I look at a URL that I have for an attachment via my fileVault thing it looks like this:

 

https://server.domain.com/folder%5Cdbname.nsf/0/08FE9BBD9066DB7985257CFB0053DE80/%24File/P8280565.JPG

That's what I end up computing that seems to work.  Hopefully this helps you.  

Please let me know of your progress here.

 

Dave

NotesIn9

Aug 15, 2014, 12:27 PM
298 Posts
That url is what I usually see
Note that in David's url it is escaped (which is a best practice).  I always use http://server/database/view/docref/$file/nameofattach

where docref is a value in the first sorted column in the view. Or, you can use "0" for the view and supply the document unid.

Once you compute that there is an escape method to escape it if you want.

Howard
Aug 19, 2014, 11:29 PM
7 Posts
Thanks, all!

Thanks for all of the help, everyone.  Taking inspiration from David, we created a field to compute the URL of the attachment. That field was then displayed on the Xpage.

The formula language is as follows:

@If ($File = ""; "Attachments Fail to Exist" ;
@Implode( @Explode(
"<a href="+"\"http://domino/county/liaisons.nsf/"+@Text(@DocumentUniqueID)+"/$FILE/"+@Text(@ReplaceSubstring(@AttachmentNames;" ";"%20"))+"\">" +@Text(@AttachmentNames)+"</a>";";");"<br>" ))

The result is a series of links, or, in the event of no attachments, a message stating "attachments fail to exist."

Thanks again.

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal