IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 9 replies
  • Latest Post - ‏2013-04-29T08:10:56Z by doorsuse
doorsuse
doorsuse
6 Posts

Pinned topic Detect modified or new objects in a module

‏2013-04-25T10:40:19Z |

Hi,

Is there anyway to detect all the modified ro new objects in a module.

I have the following situation:

  The user opens a module, edits/creates some objects. When he closes the module i 

  have to create a link between new/edited objects to another object in a different module.

  For that i need to identify all the new/edited objects.

I have tried with history but with no luck.

 

Thanks a lot in advance.

 

  • Wolfgang Uhr
    Wolfgang Uhr
    218 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T10:43:36Z  

    Why didn't you have luck in using the history? There is a session number inside and so you have to check an integer value only.

    Sorry actually I've no doors and cannot post a code snippet.

  • doorsuse
    doorsuse
    6 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T11:47:03Z  

    Why didn't you have luck in using the history? There is a session number inside and so you have to check an integer value only.

    Sorry actually I've no doors and cannot post a code snippet.

    I can extract the session number (which is an int), but how do i know if the session is newly created (since the module has been opened)

    For eg:

    Session  Modified ....

    1

     2

    3

    I would extract session number as 3,  let us assume 2,3 are from today which have already been processed. Since then there has not been any chnage. How would i know in that case?

    what i wanted to do is to save the session number when the module is opened, and then while the module is being closed

    to check the session number. If it is greater than the earlier saved number then there is some modification. I was not successful because i didnt know how to save this session number in between two dxl scripts

  • Johnny_P
    Johnny_P
    25 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T12:03:07Z  
    • doorsuse
    • ‏2013-04-25T11:47:03Z

    I can extract the session number (which is an int), but how do i know if the session is newly created (since the module has been opened)

    For eg:

    Session  Modified ....

    1

     2

    3

    I would extract session number as 3,  let us assume 2,3 are from today which have already been processed. Since then there has not been any chnage. How would i know in that case?

    what i wanted to do is to save the session number when the module is opened, and then while the module is being closed

    to check the session number. If it is greater than the earlier saved number then there is some modification. I was not successful because i didnt know how to save this session number in between two dxl scripts

    I do not really understand what you are trying to accomplish, but if you want to store the session number for your script, I would store it in a module attribute. Just create an integer attribute and overwrite it everytime you made sure, that you got all the changes.

    Note: a new session is only generated when you open the module in exclusive or shareable edit mode, not when you open the module read only!

  • GregM_dxler
    GregM_dxler
    163 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T13:09:33Z  

    The easiest way I found to find new/modified objects is to just use the last modified date.  Set a filter to only show objects that were last modified after a certain date.  Of course, this is assuming you know what date to use.  Maybe that is the concern?  If your only interested in new objects and not modified objects, then you can loop through the filtered objects history to see if it was a new object at the last modified date.  Embedding a session number or some other kind of semiphore (we use a change request number in an attribute) is only as good as the person putting it in when they make changes.

    Greg

  • GregM_dxler
    GregM_dxler
    163 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T13:10:23Z  

    The easiest way I found to find new/modified objects is to just use the last modified date.  Set a filter to only show objects that were last modified after a certain date.  Of course, this is assuming you know what date to use.  Maybe that is the concern?  If your only interested in new objects and not modified objects, then you can loop through the filtered objects history to see if it was a new object at the last modified date.  Embedding a session number or some other kind of semiphore (we use a change request number in an attribute) is only as good as the person putting it in when they make changes.

    Greg

  • Wolfgang Uhr
    Wolfgang Uhr
    218 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T13:23:26Z  
    • doorsuse
    • ‏2013-04-25T11:47:03Z

    I can extract the session number (which is an int), but how do i know if the session is newly created (since the module has been opened)

    For eg:

    Session  Modified ....

    1

     2

    3

    I would extract session number as 3,  let us assume 2,3 are from today which have already been processed. Since then there has not been any chnage. How would i know in that case?

    what i wanted to do is to save the session number when the module is opened, and then while the module is being closed

    to check the session number. If it is greater than the earlier saved number then there is some modification. I was not successful because i didnt know how to save this session number in between two dxl scripts

    1. If you want to find the sessions of the last day then you can use the "Last Modification Date". This value does not provide the time only the date and so you cannot use it only to find the changes in the last session.

    2. How can you find the value? -> There is a history in the module. You should have a look to the history viewer http://www.smartdxl.com/content/?page_id=125. This may help you.

  • llandale
    llandale
    2960 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-25T20:36:11Z  

    You have some sort of pre-save Module trigger to do the linking?

    Date session() tells you the date the current session began.

    HistorySession hs; for hs in mod do{date datHS = when(hs); int numHS = number(hs)} tells you which session started when.  Compare to the date of the current session and you know which HistorySession to look for in History.

    For Shared modules I believe the Sessions and the History may be OUT of cronological order so looking for the "LAST" session might not work.

    -Louie

  • Wolfgang Uhr
    Wolfgang Uhr
    218 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-26T06:35:15Z  
    • llandale
    • ‏2013-04-25T20:36:11Z

    You have some sort of pre-save Module trigger to do the linking?

    Date session() tells you the date the current session began.

    HistorySession hs; for hs in mod do{date datHS = when(hs); int numHS = number(hs)} tells you which session started when.  Compare to the date of the current session and you know which HistorySession to look for in History.

    For Shared modules I believe the Sessions and the History may be OUT of cronological order so looking for the "LAST" session might not work.

    -Louie

    > For Shared modules I believe the Sessions and the History may be OUT of cronological order so looking for the "LAST" session might not work.

    In this case you have to store the "last investigated session id" in a modul attribute?

  • Adamarla
    Adamarla
    75 Posts

    Re: Detect modified or new objects in a module

    ‏2013-04-26T15:20:08Z  

    > For Shared modules I believe the Sessions and the History may be OUT of cronological order so looking for the "LAST" session might not work.

    In this case you have to store the "last investigated session id" in a modul attribute?

    You can't change module attributes in shareable edit mode