CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> IDE/GUI

 Custom Insert/Update field default value

Print topic Send  topic

Author Message
grolon

Posts: 7
Posted: 02/27/2010, 5:05 AM

Hi, I can't use a default value in a text field in the Custom Insert/Update where says "If parameter is empty", and them I select "Use value" and I write a empty string (""), this is because en my table definition I put the field as NOT NULL, but the CC put a NULL value in the SQL query and then show a db error that says that the field is NOT NULL. I need that if the field is empty insert a SQL empty ('') value. I use PHP.

Example:

Supposing I left blank the field in the Record Form:

INSERT INTO table(field) VALUES(''); 
View profile  Send private message
datadoit
Posted: 02/27/2010, 7:05 AM

This is a wee bit confusing. It's not working because you're trying to
put a null value into a NOT NULL field? The field definition needs to
be changed to allow NULL values. Or am I the confused one?
mentecky

Posts: 321
Posted: 03/01/2010, 4:25 AM

In "Project Settings" on the "General" page try unchecking the box marked "Exclude missing fields/parameters from data updates"

Rick
_________________
http://www.ccselite.com
View profile  Send private message
grolon

Posts: 7
Posted: 03/01/2010, 11:55 AM

datadoit:

I don't want to put a NULL value in the table. I want that CC put a empty string(''). I can't change the table structure because other systems that use the same table only work with this value (empty string). The problem is that the CSS insert/update a NULL value if you left a field in blank and I want that CC use the default value(empty string) in case of a field is blank. You set the default value in the Custom Insert/Update Dialog.

I will try Rick . Thanks
View profile  Send private message
grolon

Posts: 7
Posted: 03/01/2010, 12:03 PM

Quote mentecky:
In "Project Settings" on the "General" page try unchecking the box marked "Exclude missing fields/parameters from data updates"

Rick


Didn't works Rick. The CC is traying to insert a NULL value yet.
View profile  Send private message
datadoit
Posted: 03/01/2010, 2:00 PM

Verified that in the data table definition the default value is ''
(empty string) and not NULL?
grolon

Posts: 7
Posted: 03/02/2010, 4:53 AM

Quote datadoit:
Verified that in the data table definition the default value is ''
(empty string) and not NULL?


Yes, Is it.
View profile  Send private message
davidwoo

Posts: 53
Posted: 03/02/2010, 7:28 PM

I also try to fix the problem you mentioned here but no luck.
View profile  Send private message
damian

Posts: 838
Posted: 03/03/2010, 2:17 PM

if the field is set to NOT NULL why are you leaving it empty? its set that way for a reason...

anyway - if you want to leave it empty always just dont include the field in your grid.... if that field isnt in your grid the submit wont try to update it.

if you sometimes want to put a value there and other times you want it empty (but not null) try setting a default value of '-' or ' '....

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
grolon

Posts: 7
Posted: 03/04/2010, 4:28 AM

Quote damian:
if the field is set to NOT NULL why are you leaving it empty? its set that way for a reason...

anyway - if you want to leave it empty always just dont include the field in your grid.... if that field isnt in your grid the submit wont try to update it.

if you sometimes want to put a value there and other times you want it empty (but not null) try setting a default value of '-' or ' '....


Yes, I sometimes want to put a value there and other times I want to left empty. If I put a default value ( empty ' ' ), CC insert/update NULL, ignoring my default value. I can't put '-' as default value because this field is concatenated width other fields.
View profile  Send private message
grolon

Posts: 7
Posted: 03/04/2010, 5:09 AM

The support team of CodeCharge report to me that currently empty string may be used only if Custom Insert/Update Type is set to SQL. I tried and it works. I would prefer this works when the Custom Insert/Update Type is set to Table too, but it resolve the problem now for text fields.

For numeric fields that permits NULL, when Custom Insert/Update Type is set to SQL, I need if the field is empty CC put a NULL value, but use the default value (nothing) and generate a bad SQL:

INSERT INTO table (textField, intergerField) VALUES ('', )
View profile  Send private message
dragoon


Posts: 173
Posted: 03/04/2010, 2:27 PM

Make use of a stored procedure and alter the info there
But I think you chose a wrong path; you should consider re-thinking database structure
View profile  Send private message
grolon

Posts: 7
Posted: 03/09/2010, 4:40 AM

Quote dragoon:
Make use of a stored procedure and alter the info there
But I think you chose a wrong path; you should consider re-thinking database structure

Thanks for your response, but I can't change the database structure because other systems are reading the table and working.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.