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!
|
|
Attaching Documents
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 |
|
|
|
Re: Attaching Documents
Posted: 19 Apr 06 12:36 PM
|
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. |
|
|
|
Re: Attaching Documents
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? |
|
|
| |
| |
| |
|
Re: Attaching Documents
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
|
|
|
|
Re: Attaching Documents
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 |
|
|
|
Re: Attaching Documents
Posted: 02 Oct 06 11:42 AM
|
fiogf49gjkf0d 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. |
|
|
|
Re: Attaching Documents
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? |
|
|
|