Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, May 5, 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 - Legacy Development
Forum to discuss SalesLogix legacy development including views, scripts, etc.. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Legacy Development | New ThreadView:  Search:  
 Author  Thread: Accountsummary in Legacy Script
Dan Carvin
Posts: 227
 
Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Feb 09 6:05 PM
I'm updating a custom legacy plugin that replaces the Account Hiearchy view. To correctly set Parent/Child account relationships, I need to set accountsummary.parentid as well as account.parentid.

I'm trying to set a handle to accountsummary, but I'm getting no recordset back.

When I open database manager, accountsummary isn't there. When I search accountsummary in all scripts, I have no reference to accountsummary in any legacy script, but several Active Scripts access it the same way they do other tables.

So is there some reason Legacy scripts can't access accountsummary?
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Feb 09 3:11 AM
No, there is no reason. However, you won't find it in DBMgr as it's hidden (you should find it in EntMgr/Studio). You just work with it as you would any other table.
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Feb 09 11:39 AM
I'm working on other projects for the rest of the week, but here's some more information:

The legacy code I'm trying to use to write the parentID accountsummary was copied & adapted from code in the same script that writes the new parentID to the account table, so I'm using the same variables for account & parent ID. This script also writes other values to a custom extension table.

The behavor I'm getting is that the parentID is written to the account table (as it was before), but not accountsummary. This results in the View Heirchy form not working properly, as it uses accountsummary.

The client throws no error messages when the script runs, but when I look at SLXProfiler, I see two inserts statements failing when it tries to run insert statements into account and the custom extension table using the existing account ID. But the script contains no inserts, only updates. Profiler does show a valid select statement on accountsummary, but the update does not appear.

I've confirmed that the account and accountsumary records don't have mismatched seccodeids. I'm not sure what the Provider is doing with this script.

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Feb 09 11:47 AM
What errors were showing when the statement fails ?
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 09 12:36 PM
I found a typo which prevented the accountsummary record from being udated, but I'm still getting the mysterious failed insert statement in SLX Profiler. The error message is:

The statement has been terminated. : Cannot insert duplicate key row in object 'ACCOUNT' with unique index 'ACCOUNT_PRIMARY'.

I believe this refers to the captured statement:

INSERT INTO ACCOUNT (PARENTID,MODIFYUSER,MODIFYDATE) VALUES ([DBTYPE_STR,"AYV3MA001VPY"],[DBTYPE_STR,"ADMIN "],[DBTYPE_DBTIMESTAMP,20090218 18:15:01.000])

I'm not sure why it's trying to insert a record with no ID (The cause of the error) when the script has no insert logic.

Another curious thing is that this code is inside a For Next Loop of For i = 0 to iCount. iCount is the number of children accounts you've selected from a grid to add the parentID to. The errors seem to happen the second time around, but if you've only selected one Account to be the child account, shouldn't this loop be executed only once? Should it be For i = 1 to iCount instead?
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 09 12:52 PM
I don't think this is the section - the issue is with account table (not accountsummary) - and the number of params (and datatypes) is actually correct in the INSERT you showed ??

Try this (on a COPY of your live system):

delete from account
where accountid =
(select accountid from account
group by accountid
having count(accountid) > 1)


How many rows does it delete - it should delete 1 (or more)

This should then enable it to work.
[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 09 2:25 PM
I got 0 rows affected.

The fields that the insert statement is trying to insert are the ones the update is supposed to update.

As I said, the code is executing twice. The first time around it works properly, updating the fields it should update. But the second time around it tries to update the account record where accountid = '' There isn't one, so it seems to convert the update to an insert which fails (although the end result - two accounts with a parent/child link - is correct).
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Feb 09 3:17 PM
Sorry, was answering a totally different thread and the SQL I posted has *NOTHING* to do with this issue - sorry !!!

This appears to be an execution issue - where is this running from ? Sometimes, yes, things do fire twice and you have to code for that (e.g. check if AccountID is null and exit from routine if so).
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Accountsummary in Legacy Script Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Mar 09 9:12 AM
Dumb question time: what version of SLX?
[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): 5/5/2024 8:41:00 AM