Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, June 18, 2025 
 
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: Custom Association Table
David Joseph
Posts: 13
 
Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 May 07 6:49 PM
fiogf49gjkf0d
Hello All,

I have a Custom table called Relationship simmilar to the association table.. I have 2 fields on that table P_ACCTNUM and C_ACCTNUM; the key field on the account table is the INTERNALACCOUNTNO field.

when I create a data grid and display these two fields using INTERNALACCOUNTNO as the bindID it works fine.. now, I want to add a 3rd feild to the data grid "child Acccount name" , I create a local join to the Account table and link the C_ACCTNUM back to the account table (INTERNALACCOUNTNO ) to display the account name.. sounds simple , however it does not work for .. it gives me an error saying invalid join..

Any help is appricicated

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 May 07 8:03 PM
fiogf49gjkf0d
Although InternalAccountNo may be your primary key, it is not recognised as such by SLX.

I would recommend storing the standard SLX AccountID field as your FK in all other tables that link to account. That's the way SLX was designed to work.

[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 May 07 10:02 AM
fiogf49gjkf0d
Maybe it was designed that way, but shouldn't it still work as a SQL statement? David, could you post the SQL statement from the grid after adding the faulty join?
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 May 07 6:07 PM
fiogf49gjkf0d
In my reply, I was making the assumption that, as neither of the join fields was recognised by SLX as PK or FK, the grid was throwing the error. However, I've just tried joining a couple of very unlikely fields and had no problems.

That's another way of saying that I haven't got a clue
[Reply][Quote]
David Joseph
Posts: 13
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 07 4:38 PM
fiogf49gjkf0d
below is the Query ; The first Query work.. it displays all the child account no but when I join the C_ACCTNUM back to the Account table it retuns no records

P.S. I use the INTERNALACCOUNTNO as the bind variable


SELECT A1.FOCI_RELATIONSHIPID, A1.C_ACCTNUM, A1.CREDITLIMIT FROM FOCI_RELATIONSHIP A1 WHERE A1.P_ACCTNUM = :BindID


SELECT A1.FOCI_RELATIONSHIPID, A1.C_ACCTNUM, A2.ACCOUNT A2_ACCOUNT, A1.CREDITLIMIT FROM FOCI_RELATIONSHIP A1 LEFT OUTER JOIN ACCOUNT A2 ON (A1.C_ACCTNUM=A2.INTERNALACCOUNTNO) WHERE A1.P_ACCTNUM = :BindID
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 07 4:58 PM
fiogf49gjkf0d
I have an idea of what the problem might be - your SQL statement looks good, except for one possibility. To perform the join, I think SQL server needs the fields being joined to be the same data type. In your statement, if A1.C_ACCTNUM is a numeric type field like an int, then that might be the reason for the failure, as I checked, and INTERNALACCOUNTNO is a varchar. I tried a join between an int field and a varchar, and I got the following error: "Conversion failed when converting the varchar value 'A6UJ9A00CIJ4' to data type int." You'd think it would convert the other way around, converting the int field to a varchar, but it didn't. If you haven't already, try running the statement in SQL Query Analyzer or Management Studio. I'm using SQL Server 2005, so if you are using 2000, you might get a different error message.

Just for kicks, I decided to convert the int field being joined to see if it would work correctly, and it did. Here's the statement I used first:
SELECT Count(*) FROM Account A JOIN Activity C ON A.AccountID = C.Type (Didn't work)
And the statement with the conversion:
SELECT Count(*) FROM Account A JOIN Activity C ON A.AccountID = Cast(C.Type As VarChar) (Worked correctly)

Of course, you wouldn't be able to do that in a datagrid in SalesLogix. As far as a solution is concerned (if what I mentioned above is the cause of the error), you may need to create or find a field of type int, and use that to store the external ID instead of using INTERNALACCOUNTNO. That could solve the problem, I think. Let us know how it goes.
[Reply][Quote]
David Joseph
Posts: 13
 
Re: Custom Association TableYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 07 6:24 PM
fiogf49gjkf0d
both the fields are of the same datatype; and my joins works corectly on SQL server.. its just on the SLX client I am having issues. I have come up with a working workaround. but, I would like to find out if I have a simple solution

My workaround for this issues

1) I created a new table in Archiet called Relationship_V with the same fields as the relationship table
2) I went to enterprise manager and droped that table
3) I created a view with the same name Relationship_V that has the join buit in it
4) now I use the Relationship_V in SLX and it works fine

[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 © 2025 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): 6/18/2025 8:57:07 AM