24
Views
4
Comments
Solved
Default value for the id attribute of an entity

What could possibly be the use of having a default value for the id attribute (which also serves as primary key) of an entity?

Rank: #89
Solution

Hi Nishit,

When you set entity attribute as primary key and Auto_number than no need to save any default value (and does not work in this case) but 

if not set auto-number than set default value and when you not pass value from your logic it set delfult value but 

Primary key is always Unique.

IF Entity attribute is other than primary key then you can set default value like-datetime column for currdatetime,

text for "Default Value",Integert for 0



Hope this will help you.


Regards

Rahul Sahu

Rank: #89
Rank: #6606

Hi Rahul ,

Thanks for you reply. 


But my question was: Since the id can be set as auto-numbered , what is the use of having a default value for it?

Because when it is auto-numbered , we do not need to set a value anyway?

Rank: #89
Solution

Hi Nishit,

When you set entity attribute as primary key and Auto_number than no need to save any default value (and does not work in this case) but 

if not set auto-number than set default value and when you not pass value from your logic it set delfult value but 

Primary key is always Unique.

IF Entity attribute is other than primary key then you can set default value like-datetime column for currdatetime,

text for "Default Value",Integert for 0



Hope this will help you.


Regards

Rahul Sahu

Rank: #6606

Thanks Rahul