Topic
  • 7 replies
  • Latest Post - ‏2012-05-07T15:46:25Z by llandale
vasgyuszi
vasgyuszi
100 Posts

Pinned topic Filter on system attribute "Last Modified On"

‏2010-09-30T13:56:20Z |

Dear DOORS Experts,

please switch on the light in my head referring to the topic in the subject.

Why isn't works this:

Date dateOfInterest =  dateOnly(today)
Filter f = attribute "Last Modified On" >= dateOfInterest

 


Doesn't matter which operator I use, it won't work....

Thanks alot,
vasgyuszi

 

Updated on 2013-12-23T19:22:33Z at 2013-12-23T19:22:33Z by JAntley
  • vasgyuszi
    vasgyuszi
    100 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2010-10-01T07:19:41Z  
    I've figured out:

    the variable (to what will be the attribute compared) shall have 'string' type and not 'Date'.

    BUT the attribute 'Last Modified On' HAS the type of Date.

    Every logical and correctly implementeg programming language does comparing between identical types, but thic crappy DXL of course not. And of course it's nowhere documented. .... I could say some rude words... This very poor documentation costs alot of money for the projects they using DXL...
  • vasgyuszi
    vasgyuszi
    100 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2010-10-01T10:52:31Z  
    • vasgyuszi
    • ‏2010-10-01T07:19:41Z
    I've figured out:

    the variable (to what will be the attribute compared) shall have 'string' type and not 'Date'.

    BUT the attribute 'Last Modified On' HAS the type of Date.

    Every logical and correctly implementeg programming language does comparing between identical types, but thic crappy DXL of course not. And of course it's nowhere documented. .... I could say some rude words... This very poor documentation costs alot of money for the projects they using DXL...
    Well:

    at "if" comparison shall be both variables from the same type (in my cas both Date):

    if (<Date> >= <Date>){
    ...
    }
    BUT

    for building a filter:

    Filter f = attribute "Last Modified On" >= <string>

    Who understands it???
  • Mathias Mamsch
    Mathias Mamsch
    2135 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2010-10-01T21:23:26Z  
    • vasgyuszi
    • ‏2010-10-01T10:52:31Z
    Well:

    at "if" comparison shall be both variables from the same type (in my cas both Date):

    if (<Date> >= <Date>){
    ...
    }
    BUT

    for building a filter:

    Filter f = attribute "Last Modified On" >= <string>

    Who understands it???

    The reason is the DXL syntax. It is not only for filtering, also for the default value in attribute creation. DOORS uses undocumented datatypes to enable its syntax. Example:
     

    AttrDef ad = create object attribute "NewAttribute" of type "Text"
    

     


    doesn't this look nice?? Much like a natural language construct. Nice idea. Unfortunately this is done by a construct of undocumented perms and types:

     

     

     

    AttrDef create (AttrDef__)
    AttrDef__ object (AttrDef__)
    AttrDef__ attribute (string)
    _y of (_y)
    AttrType__ type (string)
    AttrDef__ ::.. (AttrDef__, AttrType__)
    AttrDef__ ::.. (AttrType__, AttrDef__)
    

     


    Lets take together all the perms for attribute creation:

     

     

     

     

     

     

     

     

    AttrDef__ ::.. (AttrMultiVal__, AttrDef__)
    AttrDef__ ::.. (AttrMultiVal__, AttrDef__)
    AttrDef__ ::.. (AttrDefVal__, AttrDef__)
    AttrDef__ ::.. (AttrLocaleVal__, AttrDef__)
    AttrDef__ ::.. (AttrDef__, AttrDescVal__)
    AttrDef__ ::.. (AttrDef__, AttrInhVal__)
    AttrDef__ ::.. (AttrDef__, AttrBarsVal__)
    AttrDef__ ::.. (AttrDef__, AttrDateVal__)
    AttrDef__ ::.. (AttrDescVal__, AttrDef__)
    AttrDef__ ::.. (AttrDef__, AttrLocaleVal__)
    AttrDef__ ::.. (AttrDxlVal__, AttrDef__)
    AttrDef__ ::.. (AttrDateVal__, AttrDef__)
    AttrDef__ ::.. (AttrHideVal__, AttrDef__)
    AttrDef__ ::.. (AttrHistVal__, AttrDef__)
    AttrDef__ ::.. (AttrDef__, AttrDxlVal__)
    AttrDef__ ::.. (AttrDef__, AttrHistVal__)
    AttrDef__ ::.. (AttrInhVal__, AttrDef__)
    AttrDef__ ::.. (AttrBarsVal__, AttrDef__)
    AttrDef__ ::.. (AttrDef__, AttrHideVal__)
    AttrDef__ ::.. (AttrDef__, AttrDefVal__)
    AttrDef__ ::.. (AttrDef__, AttrMultiVal__)
    AttrInhVal__ inherit (bool)
    AttrDateVal__ date (bool)
    AttrDxlVal__ dxl (string)
    AttrDescVal__ description (string)
    AttrHistVal__ history (bool)
    AttrHideVal__ hidden (bool)
    AttrType__ type (string)
    AttrMultiVal__ multi (bool)
    AttrLocaleVal__ locale ()
    AttrDefVal__ default (string)
    AttrBarsVal__ changeBars (bool)
    

     


    Now wanting to have that same syntax with "type equality" they would have to split up the default perm for 6 different types: bool, string, real, text, integer, date.

    Same with filters: The syntax there is "attribute name == value". You probably could have 6 different ::== operators defined:

     

     

     

     

     

     

     

     

    Filter ::== (undocumentedType__, Date) 
    Filter ::== (undocumentedType__, int ) 
    Filter ::== (undocumentedType__, string) 
    ...
    undocumentedType__ attribute (string)
    

     


    Ok, so why did they not do it? Probably because in the end they store all that stuff to the database in text form anyway, so why bother. It was probably sluggishness.

    But: Why don't you just add the the missing operators yourself?

     

     

     

     

     

     

     

     

    Filter ::== (Fattr_ f, Date x) { return (f == stringOf (x, "MM/dd/yyyy")) }
     
    Date d = today()
    Filter F = attribute "Created On" == d
     
    set F
    filtering on
    

     


    Hope that gives you some insight into the crazyness of DXL :-)

    Regards, Mathias

     

     

     

     

     

     

     


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

     

    Updated on 2013-12-23T19:24:58Z at 2013-12-23T19:24:58Z by JAntley
  • Temperance
    Temperance
    4 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2012-05-05T15:37:28Z  
    Hello DXL experts,

    I am new to DXL, and after reading this last thread, I have a question regarding the system object attribute "Last Modified On". Is the date value returned from "Last Modified On" able to be compared to date value returned from the getdate() function ?
  • llandale
    llandale
    3035 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2012-05-05T20:58:00Z  
    Hello DXL experts,

    I am new to DXL, and after reading this last thread, I have a question regarding the system object attribute "Last Modified On". Is the date value returned from "Last Modified On" able to be compared to date value returned from the getdate() function ?
    "Last Modified On" gets set when you delete/undelete/move and object, or when you modify some attribute that has property "Affect change dates".

    Historically this attribute, inexplicitely, only remembered the day of the change, not the time. Recently they added the capability to remember the time as well, but in order to preserve functionality of older DXL script, getting the value by definition only gets the Date. The getDateAndTime() function, et tal, will remedy that but it requires two statements rather than just one.

    -Louie
  • Temperance
    Temperance
    4 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2012-05-05T23:28:26Z  
    • llandale
    • ‏2012-05-05T20:58:00Z
    "Last Modified On" gets set when you delete/undelete/move and object, or when you modify some attribute that has property "Affect change dates".

    Historically this attribute, inexplicitely, only remembered the day of the change, not the time. Recently they added the capability to remember the time as well, but in order to preserve functionality of older DXL script, getting the value by definition only gets the Date. The getDateAndTime() function, et tal, will remedy that but it requires two statements rather than just one.

    -Louie
    Hi Louie,

    Thank you for your response.

    So if I understand what you are saying correctly, "last Modified On" returns time and date, while getDate() only returns the date, with no time info.

    If I want to compare just date information couldn't I use the dateOnly() function, like this ?

    Date someday = dateOnly(Object."Last Modified On") then compare it with the return value from getDate()

    (only because I couldn't find the getDateAndTime() function you referred to in your post)

    What do you think ?

    Thanks - Temperance
  • llandale
    llandale
    3035 Posts

    Re: Filter on system attribute "Last Modified On"

    ‏2012-05-07T15:46:25Z  
    Hi Louie,

    Thank you for your response.

    So if I understand what you are saying correctly, "last Modified On" returns time and date, while getDate() only returns the date, with no time info.

    If I want to compare just date information couldn't I use the dateOnly() function, like this ?

    Date someday = dateOnly(Object."Last Modified On") then compare it with the return value from getDate()

    (only because I couldn't find the getDateAndTime() function you referred to in your post)

    What do you think ?

    Thanks - Temperance

    Looks like I was wrong:

    • function is "dateAndTime"
    • obj."Last Modified On" indeed returns time of day


    However, the following works indicating that "Today == ModOn" will compare the dateOnly version of ModOn. Not sure what is going on there.

     

    Object    oCurr = current
    int     cSecsInDay = 60*60*24
    Date    Today  = dateOnly(dateOf(intOf(today())))
    Date    Yestr  = dateOnly(dateOf(intOf(today())-cSecsInDay))
    Date    ModOn  = oCurr."Last Modified On"
     
    print (dateAndTime(ModOn)) "   \t" ModOn "\t" dateOnly(ModOn) "\n"
     
    if     (Today == ModOn) then print "Object modified sometime today\n"
    elseif(Yestr == ModOn) then print "Object modified sometime yesterday\n"
    


    -Louie

    Don't know why I'd think my DOORS dates would be easy, none of my dates are easy.

     

    Updated on 2013-12-23T19:25:41Z at 2013-12-23T19:25:41Z by JAntley