Darren Hall
|
Posted: 01/20/2004, 7:35 AM |
|
It would be useful to have the option of defaults for empty labels (note labels - not text fields - I know they have defaults already). I find myself time and again putting code in to display some text like 'Address unknown' if the address field is empty.
Darren.
|
|
|
peterr
Posts: 5971
|
Posted: 01/20/2004, 6:26 PM |
|
Labels have the default property already.
Put "abc" into this property to test it (including quotes).
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
Darren Hall
|
Posted: 01/21/2004, 12:26 AM |
|
That has never worked for me! If I have a record with eg the fields 'FirstName' and 'LastName' and display a grid with the defaults for the labels set to "Unknown", then the records that are empty are just displayed as empty. The default never appears.
Looking at the generated code I can see that the default is being set for the label, but then is imediately replaced by the database field, regardless of whether the field is empty or not.
Darren.
|
|
|
peterr
Posts: 5971
|
Posted: 01/21/2004, 12:46 AM |
|
I have to check into this. Which programming language do you use?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
Darren Hall
|
Posted: 01/21/2004, 1:02 AM |
|
Hi Peter,
Using ASP, SQL Server 2000, VBScript. and CCS 2.2.3.60
Darren
|
|
|
peterr
Posts: 5971
|
Posted: 01/21/2004, 7:47 PM |
|
Darren,
We verified that the default value for labels works OK and the default value is being displayed, however only if you don't bind your label to a database. Otherwise the database will overwrite the value, even if the value in the database is Null.
We believe that this is logical solution, also found in other development tools, and consistent with other controls (for example it wouldn't be desired to overwite null values with defaults in Record / TextBox).
Plus label values are never written into the database, therefore it could be actually confusing to see some value on the screen, but later not see it in the database...
Therefore we will treat your request as a special case and recommend using custom code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
BlinkyBill
Posts: 86
|
Posted: 01/21/2004, 8:35 PM |
|
Darren,
You can just include this logic in you SQL statement, View or SP. It will fairly trivial to implement.
SELECT ISNULL(mylabel, 'Address Unknown') from MY_TABLE
This method would eliminate writing custom code on the CCS side. The advantage of keep this logic out of custom code if you wish to migrate to .NET or another technology it will mean less custom code you need to convert!
Also as Peter stated this functionality is not desirable in other situations.
|
|
|
|