Hosted By

Contact Me

Misc Links

OpenNTF BlogSphere LotusGeek CoComment Custom Button

Ads by Google

Welcome to keithstric.com!

I hope you find this site useful in some way or another. I strive to bring you all sorts of geeky information and solutions to your most frustrating of issues with the occasional rant on whatever topic, technical reviews and weblog. You'll also find many products that I've developed and make available for you to use however you like. So, grab a cup of coffee, sit down and visit for a while.

« Rambling on... | Home Page| Selling Lotus Notes within your organization »

SnTT: DominoField class

05/02/2008 2:08 PM By Keith Strickland
QuickImage

I know it's been awhile since I've written, but today I've been working on an extender class for a Notes Field. Now, I'm still relatively new to creating classes and all this might not really be all that good, not sure really. But this class is called the DominoField class and adds some properties which I think would be useful. If you can think of anything that I'm missing, got obviously wrong or you think would be cool, let me know and I'll add it.

Now looking at this I don't think I'm actually extending the Notes field class. I think this is just a way to capture more information about a field. I couldn't find any documentation on extending a base Lotus Notes class but I am still looking. I tried inheiriting from the Field class but it never would compile and would actually crash my client, so you may not be able to inherit from an included base class. Then again, it could be that I just didn't know what I was doing

But some of the properties we've got here are:

  • fieldLabel - This allows you to define a label for the field for friendly validation, or whenever you need to present a field name to the end user
  • fieldModifier - This will store who the last person to modify the document was. If the value of the field has changed it will display the current user, else it'll show the last entry in the NotesDocument.Authors property
  • fieldName - This will return the name of the field
  • fieldValue - This will return the current value of the field
  • oldValue - This will return the value of the field when the DominoField class was initialized
Like I said, I don't think this is really extending the Field class but adding some useful functionality none-the-less. You can find the .lss file over in the downloads section, enjoy


Comments

ID: 1
Date: 05/03/2008 08:27:44 AM
Name: Andre Guirard
Website: http://www-10.lotus.com/ldd/bpmpblog.nsf

But you left out so much important information: where's the code, where do you get the data about the field, and what do you do with it once someone changes it? Is this DXL-based, or what?

You won't be able to extend the built-in classes -- you can only "wrap" them.

ID: 2
Date: 05/03/2008 08:43:08 AM
Name: Keith Strickland
Website: http://www.keithstric.com

Andre, It's over in the downloads section here --> { Link }

ID: 3
Date: 05/05/2008 05:47:39 PM
Name: Thomas Bahn
Website: http://www.assono.de/blog

Hi Keith,

look no further. You cannot extend product classes like NotesDocument from within LotusScript. There should be a way using the LSX Toolkit...

Where do you use this class (in the field's events, certainly, but what's the use-case this class helps to solve?)

Thomas

ID: 4
Date: 05/05/2008 06:46:09 PM
Name: Keith Strickland
Website: http://www.keithstric.com

Yes, I started using it in the Entering and Exiting events. But after a conversation with Nathan he brought up instantiating a list of DominoField objects for every field on the document. I tried that this morning and it works, a slight modification is required to the constructor to pass it a field name and then an if statement to handle it. I'll post that tomorrow.

I've never used the LSX toolkit but I'll check that out also.

Keith

ID: 5
Date: 05/05/2008 07:32:33 PM
Name: Thomas Bahn
Website: http://www.assono.de/blog/

Still, where is the use-case you want to solve with this class?

It would make a lot more sense to me, if you would add some subclasses like NumberField and DateField, which automatically restrict/validate the input. For these classes you could add something like lower/higher limit, for the Number class the maximal count of digits and so on.
Then you could add a NotesNameField, an EmailField etc.
Finally more abstract subclasses like TemplateValidationField...

I SUMMON THE UNLIMITED POWERS OF OOP!!! Emoticon

Seriously, IMHO the DominoField class alone is not quite useful enough, but with some subclasses you would be able to save the programmer some dumb work.

(Forgive me my rough tone, but it's about 1:30 am and I should have gone to bed for some time... Emoticon )

ID: 6
Date: 05/06/2008 09:09:57 AM
Name: Keith Strickland
Website: http://www.keithstric.com

Emoticon

This class started as a way to put labels with a field for a validation routine. Then I thought it might be handy to have the value of the field when the document was being opened to compare to the value the field currently holds.

I have been thinking of ways to extend the class to make validation routines a little easier/faster. Honestly, I figured I would investigate the "A kinder, gentler validation" post over on Andre's blog { Link } to use with this. I would like to extend it to make it more useful. However I'm just now delving into writing my own classes, so it may take a while Emoticon

Thanks for the ideas though and making some sub classes would be a good learning experience for me Emoticon

Post A Comment

:-D:-o:-p:-(:-):-\:-|:angry::cool::cry::dontknow::emb::hairout::laugh::rolleyes::whew:;-)

Subscribe to keithstric.com

OpenNTF

Disclaimer

The opinions and ideas posted on keithstric.com are not necessarily the opinions and ideas of my employer. The solutions, techniques and code provided here are not guaranteed or warranted in any way and are free for you to use at your own risk.