Viewing Complete Object History Automatically

I have some users complaining about having to press the "Load Previous" baseline history button repeatedly in the history tab of the object properties window. Is there a way to script it so that all baseline history is loaded for a user? That way they could just use one script rather than going through all previous baselines. I saw reference to a function that would show the object attributes tab here: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014790853

and was able to modify it to instead do:

Module mod = current 
 
string mvVer = "moduleVersion (module \"" (fullName mod) "\")" 
if (isBaseline mod) {
    Baseline b = baseline moduleVersion mod
    string sVer = (major b) ", " (minor b) ", \"" (suffix b) "\""
    mvVer = "moduleVersion (module \"" (fullName mod) "\", baseline(" sVer "))"
}
 
 
print mvVer
 
 
evalTop_ "
current = data " (mvVer) "
if (null current Module) halt
showObjectHistory()
"

This brings up and shows the object history tab. I'm lost past this point though, as none of the functions for the built-in object properties dialog are documented. I would like to be able to "press" the load previous button until no longer possible.

Some might suggest using http://www.smartdxl.com/content/?p=418 instead--this is very close, but I would prefer to use the built-in dialog if possible since it has more features.


RM_Swan - Mon Apr 17 15:25:07 EDT 2017

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Mon Apr 24 05:12:14 EDT 2017

I think the two callbacks you are looking for, are: historyShowModulePreviousCB(DBE) and historyShowModuleNextCB(DBE) ... Does this help? Do you still need the solution to this? Regards, Mathias

Re: Viewing Complete Object History Automatically
RM_Swan - Mon Apr 24 12:16:32 EDT 2017

Mathias Mamsch - Mon Apr 24 05:12:14 EDT 2017

I think the two callbacks you are looking for, are: historyShowModulePreviousCB(DBE) and historyShowModuleNextCB(DBE) ... Does this help? Do you still need the solution to this? Regards, Mathias

That looks right, and I feel like it's really close, but I'm unsure as to how I would get a handle on the DBE's in question. Is there a reference for some of these functions or did you find them a more difficult way?

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Mon Apr 24 12:41:11 EDT 2017

RM_Swan - Mon Apr 24 12:16:32 EDT 2017

That looks right, and I feel like it's really close, but I'm unsure as to how I would get a handle on the DBE's in question. Is there a reference for some of these functions or did you find them a more difficult way?

You should be able to pass "null" for the DBEs ... Inside the callbacks the DBE parameters a most of the time useless. Regarding the functions: I found them a more difficult way ;-) Regards, Mathias

Re: Viewing Complete Object History Automatically
RM_Swan - Mon Apr 24 14:30:16 EDT 2017

If I put the function in evalTop_ it does nothing and causes no errors. If I put it afterwards it kind of works but halts every time after loading only one baseline. noError() can get rid of the message, but it still only executes once. Perhaps I should modify mvVer somehow?

My change:

Module mod = current 
 
string mvVer = "moduleVersion (module \"" (fullName mod) "\")" 
if (isBaseline mod) {
    Baseline b = baseline moduleVersion mod
    string sVer = (major b) ", " (minor b) ", \"" (suffix b) "\""
    mvVer = "moduleVersion (module \"" (fullName mod) "\", baseline(" sVer "))"
}
 
 
print mvVer
 
 
evalTop_ "
current = data " (mvVer) "
if (null current Module) halt
showObjectHistory()
"

historyShowModulePreviousCB(null)

 

The resulting error message when nothing has been loaded:

moduleVersion (module "/TEST")-R-E- DXL: <standard/history/historyTab.inc:2208> unassigned array element (resetBtn[0])
Backtrace:
        <standard/history/historyTab.inc:2349> 
        <Line:20> 
-I- DXL: execution halted


The resulting error message when one or more baselines have been loaded:

moduleVersion (module "/TEST")-R-E- DXL: <standard/history/historyTab.inc:1309> unassigned array element (historyList[0])
Backtrace:
        <standard/history/historyTab.inc:2235> 
        <standard/history/historyTab.inc:2349> 
        <Line:20> 
-I- DXL: execution halted

 

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Tue Apr 25 04:24:37 EDT 2017

RM_Swan - Mon Apr 24 14:30:16 EDT 2017

If I put the function in evalTop_ it does nothing and causes no errors. If I put it afterwards it kind of works but halts every time after loading only one baseline. noError() can get rid of the message, but it still only executes once. Perhaps I should modify mvVer somehow?

My change:

Module mod = current 
 
string mvVer = "moduleVersion (module \"" (fullName mod) "\")" 
if (isBaseline mod) {
    Baseline b = baseline moduleVersion mod
    string sVer = (major b) ", " (minor b) ", \"" (suffix b) "\""
    mvVer = "moduleVersion (module \"" (fullName mod) "\", baseline(" sVer "))"
}
 
 
print mvVer
 
 
evalTop_ "
current = data " (mvVer) "
if (null current Module) halt
showObjectHistory()
"

historyShowModulePreviousCB(null)

 

The resulting error message when nothing has been loaded:

moduleVersion (module "/TEST")-R-E- DXL: <standard/history/historyTab.inc:2208> unassigned array element (resetBtn[0])
Backtrace:
        <standard/history/historyTab.inc:2349> 
        <Line:20> 
-I- DXL: execution halted


The resulting error message when one or more baselines have been loaded:

moduleVersion (module "/TEST")-R-E- DXL: <standard/history/historyTab.inc:1309> unassigned array element (historyList[0])
Backtrace:
        <standard/history/historyTab.inc:2235> 
        <standard/history/historyTab.inc:2349> 
        <Line:20> 
-I- DXL: execution halted

 

Hmm we need to be more creative here.

1. We should not place the code outside evalTop_ ... This will only invite for crashes, when data from the local DXL context is stored in the global context. 

2. Since showObjectHistory will execute "show" you NOT should place any code after it because show() will end the DXL. When the GUI is already open, this might be differently, but you probably want the code to work always

Therefore you should place a 2nd evalTop_ after the first one. We make a timer, that will click the button for us until the last baseline is loaded. 

So you can try something like this: 

Module mod = current 
 
string mvVer = "moduleVersion (module \"" (fullName mod) "\")" 
if (isBaseline mod) {
    Baseline b = baseline moduleVersion mod
    string sVer = (major b) ", " (minor b) ", \"" (suffix b) "\""
    mvVer = "moduleVersion (module \"" (fullName mod) "\", baseline(" sVer "))"
}
 
print mvVer
 
evalTop_ "
current = data " (mvVer) "
if (null current Module) halt
showObjectHistory()
"

evalTop_ "
DBE theTimer = null; 
void timerFunc(DBE) { 
     if (theTimer != null && oldestLoadedVersionIndex == 0) stopTimer(theTimer); 
     historyShowModulePreviousCB(null); 
} 
theTimer = timer (objectProperties, 100, timerFunc, \"previousLoader\"); 
startTimer(theTimer); 
"

Maybe that helps, regards, Mathias

 

Re: Viewing Complete Object History Automatically
RM_Swan - Fri Apr 28 12:21:57 EDT 2017

Mathias Mamsch - Tue Apr 25 04:24:37 EDT 2017

Hmm we need to be more creative here.

1. We should not place the code outside evalTop_ ... This will only invite for crashes, when data from the local DXL context is stored in the global context. 

2. Since showObjectHistory will execute "show" you NOT should place any code after it because show() will end the DXL. When the GUI is already open, this might be differently, but you probably want the code to work always

Therefore you should place a 2nd evalTop_ after the first one. We make a timer, that will click the button for us until the last baseline is loaded. 

So you can try something like this: 

Module mod = current 
 
string mvVer = "moduleVersion (module \"" (fullName mod) "\")" 
if (isBaseline mod) {
    Baseline b = baseline moduleVersion mod
    string sVer = (major b) ", " (minor b) ", \"" (suffix b) "\""
    mvVer = "moduleVersion (module \"" (fullName mod) "\", baseline(" sVer "))"
}
 
print mvVer
 
evalTop_ "
current = data " (mvVer) "
if (null current Module) halt
showObjectHistory()
"

evalTop_ "
DBE theTimer = null; 
void timerFunc(DBE) { 
     if (theTimer != null && oldestLoadedVersionIndex == 0) stopTimer(theTimer); 
     historyShowModulePreviousCB(null); 
} 
theTimer = timer (objectProperties, 100, timerFunc, \"previousLoader\"); 
startTimer(theTimer); 
"

Maybe that helps, regards, Mathias

 

Neither the timer nor the callback appear to be functioning when run under evalTop. In general I can't seem to create a functioning timer. Putting a print or ack in a timer doesn't seem to function (evalTop or not).
 

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Sat Apr 29 05:06:21 EDT 2017

RM_Swan - Fri Apr 28 12:21:57 EDT 2017

Neither the timer nor the callback appear to be functioning when run under evalTop. In general I can't seem to create a functioning timer. Putting a print or ack in a timer doesn't seem to function (evalTop or not).
 

Uhm. The code above worked for me? What exactly do you mean, when you say "does not work"? Can you tell me what happens? A DXL error? Simply nothing? What did you expect? Regards, Mathias

Re: Viewing Complete Object History Automatically
RM_Swan - Mon May 01 14:18:47 EDT 2017

Mathias Mamsch - Sat Apr 29 05:06:21 EDT 2017

Uhm. The code above worked for me? What exactly do you mean, when you say "does not work"? Can you tell me what happens? A DXL error? Simply nothing? What did you expect? Regards, Mathias

Sorry, I should have been more descriptive. Note, I am working from a remote desktop instance of DOORS, so this may affect some functionality. We are running DOORS 9.6

What I expect to happen: The history window will open and load one or more previous baselines.

What does happen: The history window opens and no previous baselines are loaded. No error comes up.

 

To check if the timer was working I just did this:

evalTop_ "
DBE theTimer = null; 
void timerFunc(DBE) 
{
     ack(\"test\");
     print \"test\n\";
     stopTimer(theTimer);
}
theTimer = timer (objectProperties, 100, timerFunc, \"testTimer\");
startTimer(theTimer); 
"

But nothing happened. If I never run stopTimer(), then I can see that theTimer exists since I am unable to re-instantiate a pre-existing object, but for whatever reason, the timer does not seem to be running. Changing the timer refresh time (i'm assuming that's what it is) to 1 from 100 also does not seem to have any effect.

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Mon May 01 15:12:59 EDT 2017

RM_Swan - Mon May 01 14:18:47 EDT 2017

Sorry, I should have been more descriptive. Note, I am working from a remote desktop instance of DOORS, so this may affect some functionality. We are running DOORS 9.6

What I expect to happen: The history window will open and load one or more previous baselines.

What does happen: The history window opens and no previous baselines are loaded. No error comes up.

 

To check if the timer was working I just did this:

evalTop_ "
DBE theTimer = null; 
void timerFunc(DBE) 
{
     ack(\"test\");
     print \"test\n\";
     stopTimer(theTimer);
}
theTimer = timer (objectProperties, 100, timerFunc, \"testTimer\");
startTimer(theTimer); 
"

But nothing happened. If I never run stopTimer(), then I can see that theTimer exists since I am unable to re-instantiate a pre-existing object, but for whatever reason, the timer does not seem to be running. Changing the timer refresh time (i'm assuming that's what it is) to 1 from 100 also does not seem to have any effect.

Hmmm ... Note the timer instance is bound to a dialog (DB) "objectProperties" ... If you simply run the code without the above part, especially the "showObjectHistory" and there is no dialog present, this might cause problems. Regarding the remote desktop you should make a quick check with a normal gui (DB x = centered ""; realize x; DBE theTImer = timer (x, ..." to check if timers are not working in general for some reason (hard to imagine). 

Secondly you need to verify that the Object properties GUI comes up before the timer is declared, so put a print in the first part before 'showObjectHistory' and in the second part before 'startTimer' and verify that both code parts are executed. 

Regards, Mathias

Re: Viewing Complete Object History Automatically
RM_Swan - Mon May 01 15:57:50 EDT 2017

Mathias Mamsch - Mon May 01 15:12:59 EDT 2017

Hmmm ... Note the timer instance is bound to a dialog (DB) "objectProperties" ... If you simply run the code without the above part, especially the "showObjectHistory" and there is no dialog present, this might cause problems. Regarding the remote desktop you should make a quick check with a normal gui (DB x = centered ""; realize x; DBE theTImer = timer (x, ..." to check if timers are not working in general for some reason (hard to imagine). 

Secondly you need to verify that the Object properties GUI comes up before the timer is declared, so put a print in the first part before 'showObjectHistory' and in the second part before 'startTimer' and verify that both code parts are executed. 

Regards, Mathias

Here's what I have so far:

A print statement before showObjectHistory(); works, but any and all evalTop code afterward (like another print statement or the timer code) does not run.

If I remove the showObjectHistory block (ensuring that the dialog has already been opened to avoid errors), then print statements that I put before and after the startTimer call work, but a print statement inside the timer function is never called.

I'll let you know once I've been able to test the timer with a normal gui.

Re: Viewing Complete Object History Automatically
EHcnck - Mon May 01 16:04:48 EDT 2017

Mathias Mamsch - Mon May 01 15:12:59 EDT 2017

Hmmm ... Note the timer instance is bound to a dialog (DB) "objectProperties" ... If you simply run the code without the above part, especially the "showObjectHistory" and there is no dialog present, this might cause problems. Regarding the remote desktop you should make a quick check with a normal gui (DB x = centered ""; realize x; DBE theTImer = timer (x, ..." to check if timers are not working in general for some reason (hard to imagine). 

Secondly you need to verify that the Object properties GUI comes up before the timer is declared, so put a print in the first part before 'showObjectHistory' and in the second part before 'startTimer' and verify that both code parts are executed. 

Regards, Mathias

I'm seeing that same thing, code isn't loading the baselines.  Couldn't you just open all the baselines then run the showObjectHistory perm; this would load the info too?

Re: Viewing Complete Object History Automatically
Mathias Mamsch - Mon May 01 16:52:42 EDT 2017

EHcnck - Mon May 01 16:04:48 EDT 2017

I'm seeing that same thing, code isn't loading the baselines.  Couldn't you just open all the baselines then run the showObjectHistory perm; this would load the info too?

Sorry :-( It seems I came up with the code too quickly and it does not work. The "show" that is executed inside the showObjectProperties will end the DXL execution and even not allow the registered evalTop statement to be executed. Sorry @RM_Swan 89e90aab-a82b-477c-bdad-ddecdfcadd28 ​for stealing your time with that (and thanks @EHcnck 150ae499-310d-4d63-bfc8-ed8b4bcf332d​ for pointing me into rechecking)

 I tried loading all the baselines before execution by 

Baseline b; for b in mod do load(moduleVersion(module mod, b), false);

but this does not show the baselines either. I really do not see an easy, stable, way here to overcome this. Maybe you do need to resort to a custom dialog in the end? 

Regards, Mathias

Re: Viewing Complete Object History Automatically
RM_Swan - Mon May 01 18:14:08 EDT 2017

Mathias Mamsch - Mon May 01 16:52:42 EDT 2017

Sorry :-( It seems I came up with the code too quickly and it does not work. The "show" that is executed inside the showObjectProperties will end the DXL execution and even not allow the registered evalTop statement to be executed. Sorry @RM_Swan 89e90aab-a82b-477c-bdad-ddecdfcadd28 ​for stealing your time with that (and thanks @EHcnck 150ae499-310d-4d63-bfc8-ed8b4bcf332d​ for pointing me into rechecking)

 I tried loading all the baselines before execution by 

Baseline b; for b in mod do load(moduleVersion(module mod, b), false);

but this does not show the baselines either. I really do not see an easy, stable, way here to overcome this. Maybe you do need to resort to a custom dialog in the end? 

Regards, Mathias

Ahhh, show(). Yea, that would do it. I tried baseline loading as my first option, but went down this rabbit hole when that didn't work. Maybe if you did recursive dialog boxes or something weird like that you could make this method work, but it looks like we don't have a lot of good options without replicating the history dialog.