Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Attachment Id
RJ Eaton
Posts: 234
 
Attachment IdYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Nov 06 10:22 AM
fiogf49gjkf0d
Everyone,

I am currently trying to use the attachment table so I can flag out some compliance related docs. I would like to use the standard Application.basicfunctions.insertAttachmentEx to add the file.. however since I can not interact with this function I need to get the row the insert created in the DB and update it, adding my own data to fields not being used currently. We don't use the support function so I was going to use the ticket ID to relate it to my compliance table id.

I am having trouble trying to get the last attachment Id inserted into the database. I read Ryan's artical, which now has me more confused..lol, I tred the following:

Select Attachid From Attachment
Where Attachdate in (Select Top 1 Attachdate from Attachment) --- Which didn't bring me the last attachment entered into the table..

Select Max(AttachID) from Attachment --- Which didn't work either

There is the @@Indentiy function however I don't think this is what that is for.

Anyone with an idea on how I can get and be sure I am entering on the last row created in the table..?

Thanks



[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Attachment IdYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 06 3:36 AM
fiogf49gjkf0d
This SQL should get you the ID of the most recently inserted attachment record:

select a1.attachid from attachment a1 where a1.attachdate = (select max(a2.attachdate) from attachment a2)

There is a small chance that this will return more than one record - in the circumstance where multiple attachment records are written to the database within the same milli-second. Looking ahead to this, you might like to use:

select top 1 a1.attachid from attachment a1 where a1.attachdate = (select max(a2.attachdate) from attachment a2)

which can never return more than 1 record.
[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/26/2024 8:25:46 PM