Filter comparing history date

Hi.
I'm having a little problem here...
let me explain, I'm trying to create a filter or anything at all, that compares the last modification date of two different attributes of the same object.
The modification date of the attribute2 must after the modification date of attribute1.

attr2 > attr1

I created a filter using the Last Modified On, so far working perfectly, but apparently it is not enough anymore.

My simple filter:


Filter f1 = attribute 
"Object Heading" == 
"" Filter f2 

if  (exists attribute 
"Applicability") then 
{ f2 = contains(attribute 
"Applicability", 
"L450") 
} 

else 
{ f2 = attribute 
"Object Text" != 
" " 
}   Date daysSinceDate = 
"30/03/2010" Filter f3 = (attribute 
"Last Modified On") > daysSinceDate 
""   addFilter(f1 && f2 && f3)   filtering on


Like always, thank you guys for any help that you can provide...
=)
Bruwbruw - Wed Sep 12 09:04:46 EDT 2012

Re: Filter comparing history date
Peter_Albert - Wed Sep 12 10:24:02 EDT 2012

"Last Modified On" is of little use when it comes to attribute modification dates, and in any case should be handled with care, as it depends on the attribute definitions whether an attribute modification actually sets its value or not. Hence a modification in one Module can set "Last Modified On", but in another Module it doesn't.

If the attribute definitions are such that they do not generate history, your are obviously out of luck. If the changes are still in the current Version, it is relatively easy to get the modification dates from the history records and compare them:

Date attrLastModDate(string modAttName)
{ History     h HistoryType ht string      attName Date        dDate = 

null 

for h in obj 

do 
{ ht = h.type 

if (ht == modifyObject)
{ attName = h.attrName 

if (attName == modAttName)
{dDate = h.date
} 
} 
} 

return dDate 
} Date d1 = attrLastModDate(
"an attribute") Date d2 = attrLastModDate(
"another attribute")   

if (d2 > d1)
{display 
"'another attribute' was modified after 'an attribute'"
}

So basically you cannot construct a simple filter for this, but if you put the above in a layout DXL column, you can define the filter to work on that column (or you write an on-demand script with accept / reject to actually apply the filtering, if the layout DXL and the filter on the column actually work too slowly).

However, if the last modifications are buried in a baseline, then things start to get ugly, as you then have to open the previous baseline(s), find the correct Object, loop through history, etc..

Cheers,

Peter

Re: Filter comparing history date
Peter_Albert - Wed Sep 12 10:25:52 EDT 2012

Peter_Albert - Wed Sep 12 10:24:02 EDT 2012
"Last Modified On" is of little use when it comes to attribute modification dates, and in any case should be handled with care, as it depends on the attribute definitions whether an attribute modification actually sets its value or not. Hence a modification in one Module can set "Last Modified On", but in another Module it doesn't.

If the attribute definitions are such that they do not generate history, your are obviously out of luck. If the changes are still in the current Version, it is relatively easy to get the modification dates from the history records and compare them:


Date attrLastModDate(string modAttName)
{ History     h HistoryType ht string      attName Date        dDate = 

null 

for h in obj 

do 
{ ht = h.type 

if (ht == modifyObject)
{ attName = h.attrName 

if (attName == modAttName)
{dDate = h.date
} 
} 
} 

return dDate 
} Date d1 = attrLastModDate(
"an attribute") Date d2 = attrLastModDate(
"another attribute")   

if (d2 > d1)
{display 
"'another attribute' was modified after 'an attribute'"
}

So basically you cannot construct a simple filter for this, but if you put the above in a layout DXL column, you can define the filter to work on that column (or you write an on-demand script with accept / reject to actually apply the filtering, if the layout DXL and the filter on the column actually work too slowly).

However, if the last modifications are buried in a baseline, then things start to get ugly, as you then have to open the previous baseline(s), find the correct Object, loop through history, etc..

Cheers,

Peter

It should of course read



if (!

null d1 && !

null d2)
{

if (d2 > d1)
{display 
"..."
}
}
}

Re: Filter comparing history date
Bruwbruw - Wed Sep 12 11:56:44 EDT 2012

Thank you!
What you guys have shown me, its solve my problem.

The Last Modified On was working just fine for me, because the attribute I was looking affected him, but I admit that it was very error-prone.

Sorry for my english!
And again... thank you!