This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Check Item number and allowing for generating report.

tin - Monday, April 14, 2014 9:38 PM:

Dear All,

I need javascript method for preventing from generating the report.

For example, Part-->Item number starts with D001-> right click select "Test Report" it should allow the user to generate the report.

Whereas the Part--->Itemnumber starts with T001--> right click select "Test Report" it should prompt message stating it is not applicable for this selected Item number.

I have designed the Report but i dont know to do validation in Javascript method and linked with the xslt report.

Can you anyone tried this before,then please guide me.

Thanks,

Tin.

 

 

 

 



DavidSpackman - Tuesday, June 10, 2014 11:42 PM:

Hi Tin, 

 

Here is something that could be modified to do what you want.

On your report, set the location to client, and set a similar javascript method.

You should be able to use this.getProperty("item_number",""); to get your property value. 

 

var a = top.aras;
var tmpDom = a.createXMLDocument();
var parenId = this.getID();
var reportQuery;
var retVal;
 
reportQuery = '<Item type="Meeting" id="'+ parenId +'" action="get" select="">' +
  '<Relationships>' +
    '<Item type="Meeting Action Item" action="get">' +
      '<related_id>' +
        '<Item type="Action Item" action="get"></Item>' +
      '</related_id>' +
    '</Item>' +
    '<Item type="Meeting Participant" action="get"></Item>' +
  '</Relationships>' +
'</Item>';
 
tmpDom.loadXML(reportQuery);
var r = a.applyItem(tmpDom.xml);
if (r && r.indexOf("<Result") < 0)
{
   r = "<Result>"+r+"</Result>";
}
var reportNm = "Meeting Minute Agenda";
var reportNd = a.getItem("Report", "name='"+reportNm+"'", "<name>"+reportNm+"</name>", 0);
//debugger;
if (reportNd)
{
     tmpDom.loadXML(r);
     var xslStr = a.getItemProperty(reportNd, "xsl_stylesheet");
     retVal = a.applyXsltString(tmpDom, xslStr);
}
else
{
   retVal = "<H4>Report (name="+reportNm+") not found</H4>";
}
 
//Return nothing
//return;
 
//Open an new page to display report

 

return retVal;