Hello,
I don’t know if that has been reported before, but Servoy seems to fill Integer columns defined as NOT NULL with a “0”. At least that happens here on MS SQL Server 2000…
Thanks
Patrick
Hello,
I don’t know if that has been reported before, but Servoy seems to fill Integer columns defined as NOT NULL with a “0”. At least that happens here on MS SQL Server 2000…
Thanks
Patrick
Sure does, would be nice if they did not default to ‘0’ , I always have to null them out when doing searches using global Int Fields.
I think this is actually worse than just that. You define a NOT NULL column to make sure a value is entered. It doesn’t make any sense that Servoy says: the user entered no value so I set a 0 instead… There is a big difference between NULL and 0.
I agree, psuedo null
patrick:
… Servoy seems to fill Integer columns defined as NOT NULL with a 0…
When creating a new record yes, its done for ease of use, should we not do this?
No, I don’t think this should be done. I am only using NOT NULL if I know I NEED a value. So I’d rather have an error than Servoy setting something that nobody entered.
I don’t know what others think, but entering a 0 renders a NOT NULL property useless…
I agree, but maybe there is a reason for this. If a defualt value is needed, then it can be set by the auto enter properties.
I also agree that the system should not fill any column defined as not nullable with any value.
Goes for all types of fields, if you ask me.
It’s up to the developer to make sure he fills the values before saving, or else errors should apprear. Now, it would be nice if those errors are trappable (might allready be the case, didn’t look into it).
At least where I work, fields are not set to not nullable for a reason…
Paul
OK, will be disabled in Servoy 2.2rc3
I have the opposite needs.
See See http://forum.servoy.com/viewtopic.php?p=21990#21990
I think if a column is defined as not nullable it can’t be filled by default with null!
If I define a column not nullable I don’t want a null in any case!
The null value exist so the developer can know if user entered no value.
If a developer defines a column not nullable it means he don’t want to take into account this case and the default value should be empty/0/false (following the type).
If the developer wants to take into account the fact a user could leave a field without entering a value, then it have to deal with nullable columns!
See even the thread at the top.
I don’t understand why somone whant to use the nullable property in the opposite way it was created for.
I think Servoy developers in some cases makes changes too fast without evaluting things in the correct view.
I vote for this: if a column is not nullable Servoy must not set it to null in any case! Otherwise what does it means not nullable?
I was refering to an interger colum (Not Null) returning a value
I understood.
A not nullable integer column should have a default 0 value.
A nullable integer column should have a default null value.
I’d say that if you want certain values in your column upon creation of a new record, set default values for these columns.
Servoy offers a whole range of possible auto-enter values. And additionally, you can also specify this on database level.
Your case, to me, is specificly for you. If Servoy would hardcode your requirements, others might have trouble for which there would not be a solution, while the other way around, there a several solutions to your problem.
Regards,
Paul
my understanding of null was NO VALUE. I considered ‘0’ a value. I must not be following things on your level. But is causes probelms for me for example:
I have a form with all types of globals, I use it as a search form, then map the globals to their perspective fields for a search.
When the search form is opened, all my INTs are populated with ‘0’. So there is some extra coding involved
To not have all integers populate with 0 you have to use nullable columns.
In this way the default value for those column is null and not 0.
What if my column needs an integer value, it cannot be null, so it needs to be not nullable, but 0 is not an allowed value?
Nullable or not Nullable is only a column setting to restrict if a record being saved with a null value in the specific column is allowed or not.
Nullable or not is not brought into the world to easily set default values. for that purpose, there ae “Default values”. Nullable or not is only there to restrict saving a null value in a specific column.
Paul
What if my column needs an integer value, it cannot be null, so it needs to be not nullable, but 0 is not an allowed value?
In this case you have two options:
Nullable or not is not brought into the world to easily set default values. for that purpose, there ae “Default values”. Nullable or not is only there to restrict saving a null value in a specific column.
Ok, but if a default value is not defined at database level then the null value is the default value for nullable columns!
If you define a column as nullable you do 2 things:
If you need to know if user entered some value in the colum or not you have to options:
Returnig to my problem I foud this bug in Servoy 2.1 (I don’t know if it is even in 2.2beta):
I define a colum as not nullable and do duplicateRecord, then in the duplicated record the colum is assigned a default null value.
I think this is a bug because if the column is defined not nullabe it can’t have a default null value.
I’m still waiting Servoy staff comments on this…
Well, I still prefer Servoy not settign default values on it’s own. That is up to the developer. But I guess we disagree on this topic, but hey, that is allowed
Regarding your real problem with duplication not actually duplication all values: I agree 100% that that is a bug. But if you say you’re on 2.1, you might want to try 2.2, since it’s almost final.
Paul
Well, I still prefer Servoy not settign default values on it’s own. That is up to the developer. But I guess we disagree on this topic, but hey, that is allowed
Of course that is allowed, and it could be even an occasion of growth!
Regarding your real problem with duplication not actually duplication all values: I agree 100% that that is a bug. But if you say you’re on 2.1, you might want to try 2.2, since it’s almost final.
I even prefer to no install beta software. I see a lot of Servoy developers rely on feautures and bugs of beta versions (and even deploy beta versions!) and then have troubles…
But of course I could install on a test machine…
I verified and it happens even in Servoy 2.2rc7.