Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Jahren, 2 Monaten
Letzter Beitrag:
vor 5 Jahren, 2 Monaten
Beteiligte Autoren:
Yogi Yang, Paulo Oliveira, Alexandre Leclerc, Miguel C.

What should be the Default Value for Text type field?

Startbeitrag von Yogi Yang am 20.05.2013 12:22

I think the subject says it all.

I want to know as to what should be set as Default Value for Text Type data field?

Setting it to NULL will require any special programming considerations and will it impact DB's performance?


Yogi Yang


Assuming that you are talking about HF, there are several limitations and behaviors depending on what is your needs and if you are going to use these fields in composite keys for instance.
check this help page it may help you.

von Paulo Oliveira - am 20.05.2013 12:56
Thanks for the link.

But after reading the help I still cannot determine whether I should set default value of a text field to Null or Empty string?

von Yogi Yang - am 20.05.2013 13:55
Return null if empty can be usefull if you use it on a query parameter, because the query will ignore it if null.

von Miguel C. - am 20.05.2013 15:03
Do you need three types of values in text items (with content, empty string, null)?

Normally nulls are used to save space (as far as i know this one isn't true for HF), to
differentiated empty string from unknown content or to use in the query parameters to ignore them.

If you need to handle these kinds of situations use them.
Don't forget that they have need special treatment in queries, sort order and so on.

von Paulo Oliveira - am 20.05.2013 15:48
Thanks everyone for insight.

I think I will keep the default of HF - blank string instead of Null.


Yogi Yang

von Yogi Yang - am 21.05.2013 06:28
Hi Miguel and Paulo,

This is not necessary that a file / field supports Null to set a query's parameter to Null. The moment a query parameter is Null it will be ignored (i.e. the related WHERE clause will be removed from the query). There are no direct relation is this case with the data file.

Also, Null values are not indexed (i.e. not considerate as duplicate values, as does some RDBMS). So this can be very useful in some cases.

Best regards,
Alexandre Leclerc

Edit 1: Added note concerning index.

von Alexandre Leclerc - am 21.05.2013 13:26
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.