Notes design basic 2: Use the correct field data types
Category Lotus Notes
Bookmark :
The second of design basics.. (somewhat later than planned)
Maybe the title says it all, but its important to put the data in the right type of fields. This may seem obvious but the number of times I've seen a number in a text field - arrgh!. This most notably applies to dates and numbers.
Why do you want to do this? Simply because you'll not have re-manipulate the data elsewhere. So if you want your stored dates on a document to behave like dates in a view - store them in a date field. This will allow the view to see the data as a date and when sorted will sort it correctly. If the data is stored in a text field the sorting will operate on the basis that your date is just a bit of text.
Then if you have to do calculations on the data in either Formula language or LotusScript - you won't have to convert the data first - a number will be a number and a date will be a date.
It is also important to keep the use of correct data types when doing calculations either via LotusScript or Formula. If using Formula in a calculated field make sure that the return type is correct - if you return a string the field will have a data type of text, if you return a date it will have a data type of date/time - regardless of the field settings on the form. And the same goes for LotusScript - where is probably even easier to over-ride the field type .. in fact, in my experience this is usually the culprit for data being in the wrong format - someone generates a data string and stores this, leaving you with typically date/time data in a text format.
This flexibility of the data type in Notes fields might be useful in some occasions - but I've yet to find an occasion! It is great that Notes is forgiving about this at times - but this means you have to watch the data types.
Bookmark :
The second of design basics.. (somewhat later than planned)
Maybe the title says it all, but its important to put the data in the right type of fields. This may seem obvious but the number of times I've seen a number in a text field - arrgh!. This most notably applies to dates and numbers.
Why do you want to do this? Simply because you'll not have re-manipulate the data elsewhere. So if you want your stored dates on a document to behave like dates in a view - store them in a date field. This will allow the view to see the data as a date and when sorted will sort it correctly. If the data is stored in a text field the sorting will operate on the basis that your date is just a bit of text.
Then if you have to do calculations on the data in either Formula language or LotusScript - you won't have to convert the data first - a number will be a number and a date will be a date.
It is also important to keep the use of correct data types when doing calculations either via LotusScript or Formula. If using Formula in a calculated field make sure that the return type is correct - if you return a string the field will have a data type of text, if you return a date it will have a data type of date/time - regardless of the field settings on the form. And the same goes for LotusScript - where is probably even easier to over-ride the field type .. in fact, in my experience this is usually the culprit for data being in the wrong format - someone generates a data string and stores this, leaving you with typically date/time data in a text format.
This flexibility of the data type in Notes fields might be useful in some occasions - but I've yet to find an occasion! It is great that Notes is forgiving about this at times - but this means you have to watch the data types.
- 







Comments
Posted by Theo Heselmans At 15:29:49 On 26/09/2008 | - Website - |
Posted by perry downlhall At 10:44:02 On 05/11/2009 | - Website - |