You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

ViewAttachment

4 replies [Last post]
HH's picture
HH
User offline. Last seen 10 years 15 weeks ago. Offline
Joined: 07/09/2008
Posts: 17

Hello,
Is it possible to use viewattachment to serve a file sitting on the application server to the user w/o performing any additional steps like ftping a file to some other server and the calling view attachment. Or moving the file to a database table and then doing a view attachment.

I am currently moving the file to a record on the database and then calling a view attachment and eventually the delete attachment function.

A lot of overhead if you ask me. Why even move the file into the database from the app server and perfrom dml operations on the database.

Even ftping to some other server is an overkill in my opinion when all that is required is to push the file to a webserver and then to the user from there on.

Or most likely, I am not very clear on this. Any ideas ?

Thanks for your inputs.

Lepa's picture
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: ViewAttachment

>> I am currently moving the file to a record on the database and then calling a view attachment
Why do you have to move the file to a record on the database?!

View Attachment should work without doing that.

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Lepa's picture
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: ViewAttachment

HH here is an example on how you can use viewattachment:
The URL.LoginInfo below is a PS URL that you create in PeopleSoft. The URL would be something like the following:
ftp://username:password@server-file-is-on (like servername.domain.com)

/*Allow users to view FILES using viewattachment function*/

&file_location = "../../../.." | FILE_LOCATION;
&file_name = FILE_NAME;
/*MessageBox(0, "", 0, 0, &file_location | &file_name);*/

&retcode = ViewAttachment(URL.LoginInfo, &file_location | &file_name, &file_name);

If (&retcode = %Attachment_Failed) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed");
   
End-If;

If (&retcode = %Attachment_Cancelled) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment cancelled");
   
End-If;

If (&retcode = %Attachment_FileTransferFailed) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: File Transfer did not succeed");
   
End-If;


/* following error message only in PeopleSoft Internet Architecture */


If (&retcode = %Attachment_NoDiskSpaceAppServ) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: No disk space on the app server");
   
End-If;


/* following error message only in PeopleSoft Internet Architecture */


If (&retcode = %Attachment_NoDiskSpaceWebServ) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: No disk space on the web server");
   
End-If;


If (&retcode = %Attachment_FileExceedsMaxSize) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: File exceeds the max size");
   
End-If;

If (&retcode = %Attachment_DestSystNotFound) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: Cannot locate destination system for ftp");
   
End-If;

If (&retcode = %Attachment_DestSysFailedLogin) Then
   
   MessageBox(0, "File Attachment Status", 0, 0, "ViewAttachment failed: Unable to login into destination system for ftp");
   
End-If;

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

HH's picture
HH
User offline. Last seen 10 years 15 weeks ago. Offline
Joined: 07/09/2008
Posts: 17
Re: ViewAttachment

Thanks!
Since the file is on a folder accesible to the app server where the peoplecode is run, I would like to avoid doing a ftp.
Can I not provide a path to the file ?

Lepa's picture
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: ViewAttachment

Have you looked at using ViewContentURL function?

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog