Hi Community,
I have met a problem when trying to filter object list by Last Change attribute and need your help.
The story is that user want to obtain all objects, like function, cluster/data model and position, which are modified after a specified date. To accomplish this, I plan to create a report which pops up a dialog box asking for the date and then uses this date to filter objects.
However, I found the data type of attribute Last Change(Attribute(Constants.AT_LAST_CHNG_2, nLocale)) is not Date(in javascript) and it doesn't provide method to convert it into Date type. After further study, I got the class of Last Change, AAttributeTimeStampDef.
Does any one know about class AAttributeTimeStampDef? Or know how to convert Last Change to Date?
Thanks in advance.
Regards,
Will
Hi Will,
I had the same problem when I was trying to get the attribute "Constants.AT_REL_ON" of a model. I didn't find a solution so I wrote a function to convert the aris date format (which seems to be the german format, at least for me) into JavaScript Date type.
/** * Converts the aris date format into a JavaScript Date type */ function parseArisDate(arisDate) { var newDate = new Date(); if (arisDate.length() == 10 || arisDate.length() == 19) { newDate.setDate(arisDate.substr(0, 2)); newDate.setMonth(arisDate.substr(3, 2) - 1); newDate.setYear(arisDate.substr(6, 4)); } if (arisDate.length() == 19) { newDate.setHours(arisDate.substr(11, 2)); newDate.setMinutes(arisDate.substr(14, 2)); newDate.setSeconds(arisDate.substr(17, 2)); } return newDate; }
Hope this little helper is useful.
You can try
oObjDef.Attribute( nAttrTypeNum, g_nLoc ).MeasureValue();
to get a Date object.
Report classes AttrTimeDef, AttrTimeStampDef and AttrDateDef – Method MeasureValue
MeasureValue( boolean bRemoveLineBreaks )
Returns the value of the attribute as java.util.Date.
This method is also available in Business Publisher Report.
hi eva
how I can get recent change model names
could u tell me
thnks
var g_nLoc = Context.getSelectedLanguage(); var oOutput = Context.createOutputObject(); var oSelGroups = ArisData.getSelectedGroups(); for(var i=0; i<oSelGroups.length; i++) { var oModels = oSelGroups[i].ModelList(); for(var j=0; j<oModels.length; j++) { var oModel = oModels[j]; var description = oModel.Attribute(Constants.AT_DESC,g_nLoc); description.setValue("Under review – not yet approved"); } } var dReviewError = new Date(); var lastchange = oSelModel.Attribute(Constants.AT_LAST_CHNG_2, g_nLoc).getValue(); dReview.setMonth(dReview.getMonth() + 24); if (dReview < dReviewError ) { sReview = getString("TEXT_REVIEW_EXCEEDED"); }
var g_nLoc= Context.getSelectedLanguage(); var oSelGroups = ArisData.getSelectedGroups(); for(var i=0; i<oSelGroups.length; i++) { var oModels = oSelGroups[i].ModelList(); for(var j=0; j<oModels.length; j++) { var oModel = oModels[j]; var description = oModel.Attribute(Constants.AT_DESC,g_nLoc); description.setValue("Under review – not yet approved"); } }
hi eva
ok now i understood
if i changed 10 model descriptions
how can i display last change model names list
your suggessions are very helpful for me
thanks
Hi Eva,
getting the value of the attribute is not the problem.
I have a report that checks if the last release date of a model was more than 2 years ago, so I can set it for review. So I need to do something like this in JavaScript:
var dReviewError = new Date(); // dReview needs to be a date object, this won't work! var dReview = oSelModel.Attribute(Constants.AT_REL_ON, g_nLoc).getValue(); dReview.setMonth(dReview.getMonth() + 24); if (dReview < dReviewError ) { sReview = getString("TEXT_REVIEW_EXCEEDED"); }
I solved it using my conversion method above but I'm curious if ARIS provides a function for that.
Can you please share your code as I need to find models that have not been changed for past nine months.
Thanks,
Stuti
Hi All,
I am facing one issue while fetching "Last Change" attribute in using aris scripts,:
I am using "var
lastchange = oSelModel.Attribute(Constants.AT_LAST_CHNG_2, g_nLoc).getValue();"
line to get the attribute value , I am getting all values correct like date, month, minutes, sec
but in hour value it is automatically reducing its value by 1. For example if last change was done
at 11 AM in report it is giving as 10 AM. I have checked all variable also no subtraction
logic I have implemented.
Can anyone help me.