Form not allow user to leave blank on foreign key even the “ALLOW NULL” is granted


Form not allow user to leave blank on foreign key even the “ALLOW...
Author
Message
rsb1
rsb1
StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)StrataFrame Beginner (6 reputation)
Group: Forum Members
Posts: 6, Visits: 345
Dear Sir

If a form, which has a foreign key to another parent table, the form is save with leaving this foreign key blank. It encounter error when the form recall this record with error message. I have set this foreign key to accept NULL values. The problem not occurs when I cancel the relationship between the 2 tables. But delete the relationship will have no reference integrity checking with this foreign key fields.

Example:

Said the Employee table has a foreign key to Tax table. So, there is a need to have a relationship between “Employee” vs “Tax”. So that the reference integrity can be checking. But not all the employee entitled Tax. In this case, when my Employee form is saved with Tax field is NULL, next time reopen the employee form will prompt error message.

Andrew
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Not sure, but to avoid dealing with NULLs, you could set it to not accept NULLs and leave it with zero as a default value.
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

I did tried it to set default to 0 but sql server 2008 do check the reference integrity to that table whether got the primary = 0 before save.
If we let the integer field to NULL and strataframe prompt the message cannot convert NULL value to integer when we open the form.
Maybe you got the idea how to make changes in the strataframe framework to covert NULL value to integer to prevent this error.


Please advice
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi ivan,

extend to my previous reply, i know the problem occur at where and need you advice. If my foreign key "state" (data type is integer) inside my employee table allow null. Then if state no selected and is null value saved for state into employee table. when BO try to retrieve data from employee table and it hit error due to cannot convert null value to integer for state in employee table. In BO scheme, state's data type is integer.

Please advice
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Tiong.

Guess I got it wrong when I read your first post. Maybe you should leave your foreignkey NULL and deal with the NULL value. Have a look at the BO Mapper and the properties' Custom Field Properties. There you can deal with the NULL Value Option. To get you started, go to the help file under "Application Framework" / "Business Layer" / "Business Object Mapper" / "Customizing a Field".
Edited 14 Years Ago by Ivan George Borges
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi Ivan,

I want to thanks to you again and again for solving my question. It's work great...
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I am glad to hear that, Tiong.

You are most welcome. Cool
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search