How to know if a particular field in a table has changed?

Posts   
 
    
silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 02-May-2006 17:53:45   

I am using SelfServices.

Thanks for your reply.

Silat

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-May-2006 02:33:28   

If you are talking about when you are using the designer to refresh the catalog then you can use the generated log. After the refresh you will have detailed log that will contain information on all items in your catalog. Each will have an itemized report of any fields that changed and what that change is. You can even save the log as an RTF or Xml file. This will not be shown if you do an unattended refresh.

If you are talking about using generated code then I'm not sure how you would know other than receiving an error if the change results in columns at different indexes or new columns that do not have defaults and do not allow nulls.

If neither of these sound correct could you elaborate a bit on what behavior you are looking for simple_smile ?

silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 03-May-2006 15:28:55   

Hello,

Thank you for the answer. For sure I was not clear with my previous post.

In fact I am using the self services entities and I have some heavy processing to do only once one particular field has been changed.

For example my entity is called Article and have the following fields: - ID - Title - Description - Update Date. - ...

when I update my entity, I just do a save(). But if the field Description has changed in the meantime, then I have to do some additional work I would not do else.

So in my Entity Article, how can I know that the field Description has been changed since its last fetch?

Hope I am clear this time ;-)

Silat

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-May-2006 15:41:24   

You should inspect the EntityField.IsChanged boolean.

silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 03-May-2006 17:05:03   

Thanks it csounds good ;-)

However do you have a code snipllet example (c#) as I do not understand how I can link the Entity and the EntityField?

below my code example: TArticleEntity article = new TArticleEntity(23) if (article.Description.IsChanged == false) {....}

This, of course, does not compile as IsChanged() is only present in the ArticleEntityFields, not in ArticleEntity.

So how can I access it?

Thanks,

Silat

btw : TArticleFields.Description.IsChanged is always equal to false

silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 03-May-2006 21:19:17   

FOUND !

Arf, silly me. Too easy -->

if (article.Fields[(int)TArticlesFieldIndex.Description].IsChanged)