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

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.

Re: ViewAttachment

Posts: 302
Join date: 06/23/08
Lepa's picture

>> 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

Re: ViewAttachment

Posts: 302
Join date: 06/23/08
Lepa's picture

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

Re: ViewAttachment

Posts: 14
Join date: 07/09/08
HH's picture

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 ?

Re: ViewAttachment

Posts: 302
Join date: 06/23/08
Lepa's picture

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

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <div> <pre> <br> <code> <a> <em> <blockquote> <strong> <ul> <ol> <li> <dl> <dt> <b> <p> <h1> <h2> <u> <img>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>.

More information about formatting options

CAPTCHA
The question below is to prevent automated spam submissions.
3 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.