09-29-2011 10:08 AM
Anyone have a workaround for this design limitation.....in reality an Entitiy can have a relationship with itself......recursive joins should (MUST) be part of the design architecture....this is not good.
How do you show the Account.ParentId.Account.AccountName in a link control on the Account Detail View.....like the Account Name link on the Contact Detail View? I don't want a Lookup control, I want a 1995 standard Internet blue underlined Hyper Link that displays the Parent AccountName and jumps to that .aspx page when the user clicks on it.
Solved! Go to Solution.
10-03-2011 12:37 PM
Use a code snippet property to get the account name. Then, put a link control on your quickform. You should be able to bind the text of the link to your code snippet property for the Parent Account Name and the Entity ID to the parent account ID.
10-03-2011 01:44 PM
Yes - the ability to specify a relationship back to the same entity would be a nice feature. One of the reasons (although not the only reason) that SLX does not allow this is for performance. A whole lot of account related info gets loaded into the cache when we access an Account. A long inheritance chain could cause a lot of data to get loaded once we access that account.
This brings me to my other point - the most efficient way to get that account name is to use a projection query rather than doing a GetById call. For example:
Sage.Platform.RepositoryHelper<IAccount> arh = Sage.Platform.EntityFactory.GetRepositoryHelper<IAccount>();
Sage.Platform.Repository.ICriteria crit = arh.CreateCriteria();
crit.Add(arh.EF.Eq("Id", account.ParentAccountId)); // Or whatever field you're storingthe parent Account ID in here
result = crit.UniqueResult<System.String>();
This results in a simple select sent to the DB server (i.e. select account from account where accountid = 'xxxxxxxxxxxx') rather than retrieving the whole account entity and all the baggage that comes along with it.