Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - ASP/ASP.NET/Web Services/Other
Forum to discuss building external web applications for SalesLogix. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to ASP/ASP.NET/Web Services/Other | New ThreadView:  Search:  
 Author  Thread: Attaching Documents
Antony Currington
Posts: 15
 
Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 06 11:25 PM
fiogf49gjkf0d
Hi all,

I have a web site I'm building that the users will need to use to be able to upload and attach documents to records within the SalesLogix database.

I'm accessing the data via the OLE DB Connection, but can't see an easy way to attach a file to a record.

Anyone got any suggestions for the best way to do this?

Antony
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 06 12:36 PM

serevent accuhaler

serevent generic name searchengineoptimization-seo.net
fiogf49gjkf0d
Do you wish for these documents to synchronize with remotes? If so you need to call LogSendFileAttachment which currently in SLX scripting is under Application.BasicFunctions so I don't quite know how the OLE DB Provider would handle that. If synchronization isn't a problem, it's just a matter of creating the correct attachment record and copying the file to the correct location. There's nothing tricky involved there so if you have attachments created by a client, pull one of those records to use as a base to see which fields are necessary and which ones are created by the client.

The biggest snag is understanding the file prefix when files are attached. In 6.1, attachments used the 4 digit sitecode that corresponded with each remote client or one sitecode that every network client shared. In 6.2, the prefix is in the form !AttachmentID.

Here's the basic process I follow:
1) Get the full path of the file you wish to attach.
2) Calculate the filename only which will be used to prepend the prefix.
3) Calculate the file size since it's a semi necessary field in the attachment table.
4) Calculate Attachment path by using this SQL: select attachmentpath from branchoptions. Remotes have to hardcode it to Documents and Settings\All Users\Application Data\SalesLogix\Documents\ (or use registry reading to calculate the location of Documents and Settings since it's not always on a C drive)
5) Get an attachment ID.
6) Create attachment record storing filename as (Prefix)(Filename.whatever). Must be attached to a account/contact/opportunity/ticketid or else you won't be able to find it in the cient.
7) Copy file from source.file.whatever to attachmentpath.prefixfile.whatever.
8) Call Application.BasicFunctions.LogSendFileAttachment accountid, prefixfile.whatever

I personally create the record after the file is copied to check to make sure it's done correctly but you can always delete the record if that isn't done as well. If I didn't have remotes I would omit step 8 and since I don't know if it can be called from within the OLE DB Provider directly, you may not be able to synchronize attachments that were attached this way.
[Reply][Quote]
Dave
Posts: 36
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Sep 06 9:34 AM
fiogf49gjkf0d
I'm trying to load a file into an Oracle BLOB field.
I would like to use an AspUpload component from Persits Software,
but I'm having hard time with SLX OleDBProvider Connection Strings.

Any suggestions?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Sep 06 10:08 AM
fiogf49gjkf0d
Start here: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=55

You can also download the DataLik Designer here (this will help you to build a connection string): http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=36
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Sep 06 1:36 PM
fiogf49gjkf0d
Quote:
Originally posted by Dave

I'm trying to load a file into an Oracle BLOB field.

For this, the ADO AppendChunk method works really well. Here's the definition from devguru.com: http://www.devguru.com/technologies/ado/8611.asp

Microsoft has an example on how to read and write BLOBs using GetChunk/AppendChunk here: http://support.microsoft.com/kb/194975/EN-US/ The examples are geared towards SQL server but the ADO portions will work fine with Oracle as long as you are using the OLE DB Provider.
[Reply][Quote]
Dave
Posts: 36
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Sep 06 2:46 AM
fiogf49gjkf0d
Ryan, Jeremy,

many thanks for your links.

I've tried the DLDesigner, and finally, I've build this connection String:

strConnect = "Provider=SalesLogix OLE DB Provider;IntegratedSecurity= """"assword=""password"" ersist Security Info=True; User ID=""User"" ;Initial Catalog=YOUR_DATALINK_NAME;Data Source=YOUR_OLEDBSERVER;Extended Properties=""PORT=1706;LOG=ON"";Location="""";Mode=ReadWrite"

Now I'm hard-coding the user and the pass in the external ASP page I'm calling.
I'm able to get the current user name, but I would not like to ask the user to fill in the password to upload the file...
[Reply][Quote]
Duncan Cook
Posts: 164
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Sep 06 2:55 AM
fiogf49gjkf0d
Hi Dave,

This is a little nugget that I got from Ryan.
If you use the admin user in your connection string you can use the impersonate property for you user ie.
strConnect = "Provider=.......User ID=Admin......Impersonate=lee...
This way you don't need the user’s password.
--
Duncan
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Oct 06 10:12 AM
fiogf49gjkf0d
Jeremy, have you seen how the TEFs created by AppendChunk works on the SLX remotes?

Also i have another question : is this website you've mentioned hosted outside? if so , where do you have the attachments folder? Inside on a db server? ,How did you get around setting the right security permissions for your requirements?

Thanks
-Nandu
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Oct 06 11:42 AM
fiogf49gjkf0d
Quote:
Originally posted by Nandu

Jeremy, have you seen how the TEFs created by AppendChunk works on the SLX remotes?

AppendChunk shouldn't have an issue with TEFs. The first call to AppendChunk overwrites existing data so it forces you to stream the contents into the BLOB at once. If I had to guess, it's a wrapper around the ADODB.Stream object but without all of the casting overhead. I would think the data wouldn't get committed to the database officially until the Update or UpdateBatch statement was called anyway but I could be wrong.
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: Attaching DocumentsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Oct 06 8:57 AM
fiogf49gjkf0d
Yes , that is true.No problem with TEFS created. But when they get applied at the remotes they fail with the same error message it would have failed, if we were doing it without the appendchunk method.Unfortunately the append chunk method can only be used when you are dealing with one target db because of nature of how TEFS are created in SLX(meaning not multiple places like slxhost and remote database).

Now as to the original question, did you get it resolved?
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 4:39:43 PM