Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, August 16, 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!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Error on saving data..
John
Posts: 34
 
Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Oct 08 1:35 PM
Hello everyone,

I'm having a problem when i clicked the save button on a Custom Main View that is build under AccountProduct Entity. This table has a 1-M table called Mediciones and some of the control of this main view save the data there. this main view it also have another 1-1 table called AccountProductX and aldo some of the controls of the main view save data there.

The thing is that i have set both entities (Mediciones and AccountProductX) is extension property to "AccountProduct" i keep haveing this error.
----
could not insert: [Sage.SalesLogix.Entities.Mediciones#QDEMOA000852][SQL: INSERT INTO MEDICIONES (MEDICIONESID) VALUES (?)]:
The statement has been terminated. : Cannot insert the value NULL into column 'ACCOUNTPRODUCTID', table 'SLXMaqPes.sysdba.MEDICIONES'; column does not allow nulls. INSERT fails.
----

I know what is this about but i dont know how to fix it.

Thank you once again.

John
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 08 4:46 AM
Hi,

On your form to save the Mediciones value, it looks like you need to set the AccountProduct property of your mediciones entity. I think - although its difficult to ascertain your issue from the description.

Make sure you set the AccountProduct property to the current AccountProduct record you are on (probably this.BindingSource.Current) on the save click (or on the quickformload).

Thanks,
Nick
[Reply][Quote]
John
Posts: 34
 
Re: Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 08 9:32 AM
Thanks nick.

What i don't underestand is why i don't have to do this with AccountProductX.

Before i deside to add this new entity (Mediciones) the Main view was only saving data into AccountProduct and AccountProductX and the only thing i did was to set the "Is extension" property of AccountProductX to "AccountProduct" and that it, automatically start to save data into that table. Maybe the fact that this new table it is not a 1-1 table is causing troubles.

Thanks

John
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 08 9:49 AM
Yes that will definitely be the issue - I understand the problem a bit more now. You wouldnt need to explicitly set the Entity context for an extension table as SLX implies that logic. It doesnt do that for one to many's though...
[Reply][Quote]
John
Posts: 34
 
Re: Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 08 9:56 AM
So, i should set the AccountProductID by code on the save button or the load form.

Could you give me a little help here cause id didnt fully understand how this works.

I know how to add a C# snippet code, but i dont know what code to use.

Thanks a lot.

John
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Error on saving data..Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 08 10:19 AM
Ok - in the Save Action you will need something like (it wont work in the LoadAction I dont think - this is a funny way to use a one-to-many table)

//Get current binding entity (AccountProduct)
|Sage.Entity.Interfaces.IAccountProduct accProd = this.BindingSource.Current as Sage.Entity.Interfaces.IAccountProduct;

//Get an entity instance to your IMediciones...
|Sage.Entity.Interfaces.IMediciones accMed = Sage.Platform.EntityFactory.GetById(accProd.Id.ToString());

//Now need some Logic as you will either need to create a new instance, or use one above. This will differ if its the first time you save as the record will not exist...

|if(accMed.Id != null)
|{
| //It is not null, so we can just do a simple save, and its no harm to reset the AccountProduct here..
| accMed.AccountProduct = accProd;
| accMed.Save();
|} else
|{
| //It is null, we need to genereate a new instance of the entity...
| Sage.Entity.Interfaces.IMediciones newAccMed = Sage.Platform.EntityFactory.Create();
| newAccMed.AccountProduct = accProd;
| newAccMed.Save();
|}


You will need to incorporate this into the system generated save method - view the source code outputted in the deployment folder of the quickform, copy it and paste into the C# Snippet window, then work your code above into it....

This is all off the top of my head so not syntax checked. And its not something Ive done before as it is not the norm to use one to many fields as one to ones....



[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): 8/16/2025 4:14:23 AM