Is there a way to determine what the absolute number will be for the next object that is created in a given module. My first thought would be to go: |
Re: Next Object Absolute Number
int highNum = 0
for o in entire m do {
if o."Absolute Number" > highNum {
highNum = o."Absolute Number"
}
}
return highNum
|
Re: Next Object Absolute Number I know that info is stored in the database as soon as you create an object, even if you don't save the module. I see no method of predicting what it is. But I do see this command, try it out and let us know: int refcount_ (Module m)
|
Re: Next Object Absolute Number llandale - Tue Jan 19 17:38:52 EST 2010
Doesn't seem to work
int highestAbsNum(){
Object o
Module m = current Module
int highNum = 0
for o in entire m do {
int absNum = o."Absolute Number"
if (absNum > highNum) {
highNum = o."Absolute Number"
}
}
return highNum
}
print highestAbsNum() "\n"
print refcount_ (current Module) "\n"
print getServerSeqNum_() "\n"
print getClientSeqNum_() "\n"
6019 1 2037 2031
int getModuleSeqNum_(ModRef_ m)
|
Re: Next Object Absolute Number Peter.Dawson - Tue Jan 19 18:15:21 EST 2010
Doesn't seem to work
int highestAbsNum(){
Object o
Module m = current Module
int highNum = 0
for o in entire m do {
int absNum = o."Absolute Number"
if (absNum > highNum) {
highNum = o."Absolute Number"
}
}
return highNum
}
print highestAbsNum() "\n"
print refcount_ (current Module) "\n"
print getServerSeqNum_() "\n"
print getClientSeqNum_() "\n"
6019 1 2037 2031
int getModuleSeqNum_(ModRef_ m)
Don't see any other commands.
|
Re: Next Object Absolute Number llandale - Tue Jan 19 18:21:25 EST 2010
mkNodeBelowLastAbsno Object create (Last__,int) Object create(Object, int) Object create(Module, int) These don't seem to appear in the reference manual and I can't see that supplying an int to the create function of an object would do (create multiple objects??). |
Re: Next Object Absolute Number Peter.Dawson - Tue Jan 19 18:43:12 EST 2010 Paul Miller |
Re: Next Object Absolute Number SystemAdmin - Tue Jan 19 19:01:26 EST 2010 Paul Miller Now I think about it, I don't think we can use AbsNums at all in this situation. Is it clear what I am trying to achieve? If so, will start a new thread to discuss the above. Someone might have done this before. |
Re: Next Object Absolute Number Peter.Dawson - Tue Jan 19 19:44:59 EST 2010 Peter |
Re: Next Object Absolute Number Peter.Dawson - Tue Jan 19 18:43:12 EST 2010 I suspect these are residual perms from DOORS version -1 days, where perhaps you could specify an absolute number of the new object.
|
Re: Next Object Absolute Number SystemAdmin - Tue Jan 19 19:01:26 EST 2010 Paul Miller Is there a solution for this? I'm running into an issue where the customer wants to know what the highest absolute number is even if it's from a purged object. If for example the highest absolute number object is 352 but 353 to 500 had been purged. They want the report to say the highest absolute number for the module is 500. Creating a new object each time to get the highest absolute number is not an option as this report can be run numerous times and around many modules in the database. |
Re: Next Object Absolute Number If there is no elegant solution, how about creating a copy of the module and then create a "sacrificial object" in that module copy. |
Re: Next Object Absolute Number morast - Mon Nov 23 03:35:18 EST 2015 If there is no elegant solution, how about creating a copy of the module and then create a "sacrificial object" in that module copy. There is definitively no elegant solution for this. There might be non-elegant solutions though. You can find the value in the memory of the module structure and you can read them from the database / archives. Still there is a general problem with this! No report should rely on the next absolute number that is about to be generated. This number should not have any meaning in DOORS. It is simply a value, that is unique inside the module, but there is not more to it. If the report (or any other DXL program) really depends on this number, then there is definitively something wrong with the architecture. Coming myself from consulting you should go to the customer and tell him, that getting the next highest absolute number on a module is technically non feasible and convince him, that this is not what he really needs. Most probably this is just the wrong solution to a valid requirement. Just my two cents, regards, Mathias |
Re: Next Object Absolute Number Mathias Mamsch - Mon Nov 23 04:51:41 EST 2015 There is definitively no elegant solution for this. There might be non-elegant solutions though. You can find the value in the memory of the module structure and you can read them from the database / archives. Still there is a general problem with this! No report should rely on the next absolute number that is about to be generated. This number should not have any meaning in DOORS. It is simply a value, that is unique inside the module, but there is not more to it. If the report (or any other DXL program) really depends on this number, then there is definitively something wrong with the architecture. Coming myself from consulting you should go to the customer and tell him, that getting the next highest absolute number on a module is technically non feasible and convince him, that this is not what he really needs. Most probably this is just the wrong solution to a valid requirement. Just my two cents, regards, Mathias I agree that using the next absolute number is undesirable but my customer is insisting on it. Can you please elaborate on the method you mentioned to do this? Thank you. |
Re: Next Object Absolute Number bjjacobgm - Wed Jan 06 11:45:59 EST 2016 I agree that using the next absolute number is undesirable but my customer is insisting on it. Can you please elaborate on the method you mentioned to do this? Thank you. Sometime you got to do what you got to do. Here is an example dxl that will give the next Object Number,
//Predict Next Object ID
I++ |
Re: Next Object Absolute Number DOORSHAM - Wed Jan 06 13:00:42 EST 2016 Sometime you got to do what you got to do. Here is an example dxl that will give the next Object Number,
//Predict Next Object ID
I++ I already knew that solution. I was referring to when Mathias mentioned "You can find the value in the memory of the module structure and you can read them from the database / archives." If there truly is no other way than other than creating then destroying a dummy object, I'll try hard to dissuade the customer from doing this as this report can be run multiple times on a module and across multiple modules within a project, thus making many dummy objects. |
Re: Next Object Absolute Number bjjacobgm - Wed Jan 06 13:16:46 EST 2016 I already knew that solution. I was referring to when Mathias mentioned "You can find the value in the memory of the module structure and you can read them from the database / archives." If there truly is no other way than other than creating then destroying a dummy object, I'll try hard to dissuade the customer from doing this as this report can be run multiple times on a module and across multiple modules within a project, thus making many dummy objects. why not just create a trigger to fill-in a module level attribute on the the creation of an object with its id? |
Re: Next Object Absolute Number EHcnck - Wed Jan 06 15:48:49 EST 2016 why not just create a trigger to fill-in a module level attribute on the the creation of an object with its id? There is no trigger that is fired on the creation of an object. There is a trigger that it can fire when a specific attribute of an object is changed but still there is issues with deleting objects. Even if that was possible there are a lot of scenarios that would not work. For example what if there are accesses issues. You can propagate create access but on the module level could be a different access or you can login as a database admin and disable the triggers from the command line etc.
The best way is to find out on why do you need the next absolute number and if there is a reason for having that for example like predicted requirement ID for change control when you planning your changes then you might need to consider a different solution. You might have a different attribute which you populate a unique number and the next number is kept in the configuration area, or having a change proposal module that you propose the changes before the changes are made permanent or any other solution. It just depends on the use case. The absolute number is an identifier of the object in the module something line a unique id in a table in any database like access or sql or oracle.
If you put your use case there might be different ideas around. |
Re: Next Object Absolute Number bjjacobgm - Wed Jan 06 13:16:46 EST 2016 I already knew that solution. I was referring to when Mathias mentioned "You can find the value in the memory of the module structure and you can read them from the database / archives." If there truly is no other way than other than creating then destroying a dummy object, I'll try hard to dissuade the customer from doing this as this report can be run multiple times on a module and across multiple modules within a project, thus making many dummy objects. See its not so complicated to convince the customer, because he has not really the choice. You can tell him: "DOORS does not support this. I can make you a 'hack', that might crash your DOORS and might cause data loss/corruption at some point, maybe with the next DOORS version, but achieve what you want. Or we can solve the requirement behind it differently." Because clearly, knowing the next absolute number is NOT the requirement of your customer. Its a solution to a requirement you might not know yet. And this requirement can DEFINITELY be solved differently. Regards, Mathias |
Re: Next Object Absolute Number I'm still searching for a solution to this because I'm in the same boat. There must be an internal (_) DOORS function to obtain this number. morast probably has the best solution [from us hacks lol]. Make a copy of the module and add an object to obtain the next object absolute number. Then you can delete and purge the module copy. This should be something you can script as well. From there, any updating you do can just keep track of what absolute number is coming next. I was thinking the DOORS object and module history would contain everything you need but I couldn't find a way to identify the object absolute number for the purged object history data. Objects that were created but not saved also don't show up in history. So that would work if the last created object wasn't either purged or not committed; which is probably likely but not a fool proof solution. Regards, Christopher |
Re: Next Object Absolute Number chrisroy - Thu Feb 15 12:13:07 EST 2018 I'm still searching for a solution to this because I'm in the same boat. There must be an internal (_) DOORS function to obtain this number. morast probably has the best solution [from us hacks lol]. Make a copy of the module and add an object to obtain the next object absolute number. Then you can delete and purge the module copy. This should be something you can script as well. From there, any updating you do can just keep track of what absolute number is coming next. I was thinking the DOORS object and module history would contain everything you need but I couldn't find a way to identify the object absolute number for the purged object history data. Objects that were created but not saved also don't show up in history. So that would work if the last created object wasn't either purged or not committed; which is probably likely but not a fool proof solution. Regards, Christopher Mathias explained it quite well. I also tend to see the "Absolute Number" as having the same semantics as a UUID -- its only purpose is to have a unique ID. Always imagine that the number that is created with the next create() command is completely random, there is no information whatsoever in it, so you cannot give any other meaning to it besides its uniqueness.
And technically speaking: Even if there was an internal function, I am sure that it is not available to the DOORS client, I suspect that the number is created on the server, as it is possible that two users open the module in shared mode and create a new object at the same time, so the DOORS client cannot have the "next" number in its memory after opening the module.. |
Re: Next Object Absolute Number Mike.Scharnow - Thu Feb 15 12:53:11 EST 2018 Mathias explained it quite well. I also tend to see the "Absolute Number" as having the same semantics as a UUID -- its only purpose is to have a unique ID. Always imagine that the number that is created with the next create() command is completely random, there is no information whatsoever in it, so you cannot give any other meaning to it besides its uniqueness.
And technically speaking: Even if there was an internal function, I am sure that it is not available to the DOORS client, I suspect that the number is created on the server, as it is possible that two users open the module in shared mode and create a new object at the same time, so the DOORS client cannot have the "next" number in its memory after opening the module.. Mathias is brilliant and his approach is completely reasonable. There will exist a number that is the next number issued; it will be the next number after the last number issued in the module. So maybe we can also ask that question instead (what was the last number issued). There should be a function that pings the server to get what the next number will be (or what the last number issued was). What users want to do with that information is besides the point. Give us capabilities and we'll put our imaginations to work. That's the whole beauty of DXL.
Cheers,
Christopher |
Re: Next Object Absolute Number Hey all, Here's an implementation of the create copy of the module, add an object to retrieve the next Absolute Number, then delete the temporary file. You will / should uncomment the hard delete portion of the code otherwise it will leave the module where it is and won't be able to run successfully again. I just don't want to be the source of epic failure if someone tries integrating this script with their own, and they screw something up in the integration process, and it hard deletes the wrong module. There was something in the copy function that states outgoing links are copied as well. Hopefully all remains of those links are flushed in the delete and hard delete. This obviously is a band aid solution that you would only run once every now and again, and not repeatedly in loop or something (slow as molasses). Still would be delighted if someone can dig up the internal function that retrieves this number or the number indicating the last object created.
Regards,
Christopher Attachments getNextObjectNumber.dxl |