Hosted By

Subscribe to keithstric.com

Misc Links

Domino 7 OpenNTF BlogSphere CoComment Custom Button

Lotus Notes Blog Search

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.

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

SnTT: DominoField class

QuickImage Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

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

Gravatar Image1 - 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.

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

Gravatar Image3 - 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

Gravatar Image4 - 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

Gravatar Image5 - 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 )

Gravatar Image6 - 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:;-)