Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 7 of 7 total |
OT: How to implement 'value to be used instead of null' ? |
Fri, May 11 2007 10:34 AM | Permanent Link |
"Royke" | Only slightly off topic: can anyone suggest the best approach to introducing
for some fields a value that it to be used when the user leaves the field blank/null? This should not be noticable to the user, so we don't want to start filling null fields in (say) a BeforePost event. (Bit of background: we make a logistics application, and have fields such as 'weight capacity' for a container. Users may consider this irrelevant to their operation, and leave it blank. But when used in load optimization, the value should in that case be some really big number.) RJ |
Fri, May 11 2007 10:51 AM | Permanent Link |
Chris Erdal | "Royke" <royke@canada.com> wrote in
news:59B5F70E-3A8E-4E2D-B914-8EF47FB39E9C@news.elevatesoft.com: > This should not be noticable to the user, > so we don't want to start filling null fields in (say) a BeforePost > event. Royke, I use BeforePost and it's pretty invisible to the user -- Chris (XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.02 build 1) |
Fri, May 11 2007 11:14 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Royke
three suggestions 1. Do it the other way round. Define some default values as part of the table definition and allow the user to alter them to the real ones. 2. Have an additional field, not visible to the user, that you set to the required default then in the before post event set the additional field to zero if the user field has NOT been left blank. For calculations you then use the sum of the fields 3. Build the defaults into the calculation. If you're using SQL have an IF statement eg IF(weightcapcity is not null, weightcapacity, reallybignumber) Roy Lambert |
Fri, May 11 2007 12:14 PM | Permanent Link |
"Royke" | "Chris Erdal" <chris@No-Spam-erdal.net> wrote in message
news:Xns992DAB23DF0AD14torcatis@64.65.248.118... > "Royke" <royke@canada.com> wrote in > news:59B5F70E-3A8E-4E2D-B914-8EF47FB39E9C@news.elevatesoft.com: > >> This should not be noticable to the user, >> so we don't want to start filling null fields in (say) a BeforePost >> event. > > Royke, > > I use BeforePost and it's pretty invisible to the user Yes, but not the next time he/she sees the data. I would still like the field edit to be blank. Roy |
Fri, May 11 2007 12:28 PM | Permanent Link |
"Royke" | "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:4453D615-33B5-4BA7-9A12-A29684AFD127@news.elevatesoft.com... > Royke > > three suggestions > > 1. Do it the other way round. Define some default values as part of the > table definition and allow the user to alter them to the real ones. > > 2. Have an additional field, not visible to the user, that you set to the > required default then in the before post event set the additional field to > zero if the user field has NOT been left blank. For calculations you then > use the sum of the fields Sounds promising. We may try out this approach. > 3. Build the defaults into the calculation. If you're using SQL have an IF > statement eg IF(weightcapcity is not null, weightcapacity, > reallybignumber) This is what we do now, but the burden is then on the developer to remember in any 'new' use to check IsNull. Come to think of it, we could do a whole series of GetFieldValue, and never access the field directly ... > > Roy Lambert > Thanks for the suggestions. RJ |
Fri, May 11 2007 2:41 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< (Bit of background: we make a logistics application, and have fields such as 'weight capacity' for a container. Users may consider this irrelevant to their operation, and leave it blank. But when used in load optimization, the value should in that case be some really big number.) >> If using SQL for the load optimization, just use the COALESCE() function: http://www.elevatesoft.com/edb1sql_coalesce.htm If using code, just define the equivalent function in Delphi for your purposes. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, May 16 2007 10:25 AM | Permanent Link |
Chris Erdal | "Royke" <royke@canada.com> wrote in news:5D4437EA-7AC9-42B2-9B2F-
F24153DDE338@news.elevatesoft.com: Roy, >> I use BeforePost and it's pretty invisible to the user > > Yes, but not the next time he/she sees the data. I would still like the > field edit to be blank. > As you probably guessed, I hadn't understood your problem. And as usual, Roy's seen it all before and came up with a neat little workaround ! -- Chris (XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.02 build 1) |
This web page was last updated on Monday, May 6, 2024 at 03:23 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |