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 - ARAS customization - Interactive pages

sahana ks - Thursday, August 11, 2016 2:20 AM:

Hi

I want to create a custom screen that shows Items in a matrix format

like a tree table that has columns and rows. (the data is queried from ARAS database). 

I have created a html and js file outside ARAS (also did direct database connection in js). How to integrate such files into ARAS so that  I query data from ARAS and bring up the custom screen on click of a button onside one of the custom type forms

I also want this custom screen to be interactive such that if I make some action on this screen data should be updated in database table.

Appreciate any help here.



edonahue - Friday, August 12, 2016 1:44 PM:

Hi Sahana,

I recommend looking at the Express ECO Impact Matrix as an example of a custom tree grid. The Impact Matrix tab on the Express ECO form is populated by the Express ECO Impact Matrix form in the database. This form contains an HTML field that loads the custom tree grid from its contents.

If you want to call a custom form in a modal dialog, the following sample code should point you in the right direction. 



sahana ks - Friday, August 19, 2016 11:41 AM:

Hi,

Thanks for replying. I could now see  custom html page. 

One more issue I am facing.

I created a custom form that accepts two inputs. I have put a custom

button (calls another method - calculateValue() )

on this form which calculates the sum of inputs received in the form. The code of calculate method is

var res1 ="";

res1 +="<term1>"+document.forms[0].term1.value+"</term1>";

res1 +="<term2>"+document.forms[0].term2.value+"</term2>";

res1 +="<op>"+document.forms[0].op.value+"</op>";

document.parentWindow.setReturnValue(res1);

top.close();

Now when I access the generic action that loads the custom form, I enter values and click the button.

I get error as given below,

 

Client side error  -  

Event handler failed with message: TypeError: document.parentWindow is undefined

How to return values back from this method into calling function that brought up the custom form.

Please suggest.

 



edonahue - Monday, August 29, 2016 5:57 PM:

Hi Sahana,

Try the following code to pass one or more values back to the calling method:

// return selected value
var retVal = [];
retVal["MyVal"] = res1;
window.returnValue = retVal;
window.close();

You can then reference the return value in the calling method like this: res["MyVal"]



rrt - Tuesday, October 4, 2016 12:52 AM:

hi Eli Donahue

res gives me undefined its not return any value

my ok button code is

var fromDate = document.forms[0].from_date.value;
var toDate = document.forms[0].to_date.value;

if(new Date(toDate) < new Date(fromDate))
{
    alert("To Date must be greater than from date");
}
else
{
    var retVal = [];
    retVal["runReport"]="1";
    retVal["to_date"] = toDate;
    retVal["from_date"] = fromDate;
    window.returnValue = retVal;
    window.close();
}

and main method is

var q = new Item("Form", "get");
q.setAttribute("select", "id");
q.setProperty("name", "Bal_StockReport");
var r = q.apply();
alert(r);
// to set name for dialog and set itemtype of form
var param = new Object();
param.title  = "Date range selector for Item Stock"; // shown in the blue bar at top of window
param.formId = r.getItemByIndex(0).getID(); // the id of the Form to be used
param.item = this.newItem("Bal_StockReport"); // an Item of valid type, can be used to populate the Form
param.aras = top.aras; // the aras object

var options = {dialogHeight:260, dialogWidth:400};
var res = top.aras.modalDialogHelper.show("DefaultModal", window, param, options, "ShowFormAsADialog.html");
alert(res);
if (res)
{
    // Date retrived from on click event
    var From_Date = top.aras.convertToNeutral(res["from_date"], 'date', "short_date");
    From_Date= From_Date.substring(0,From_Date.indexOf("T"));
    var To_Date = top.aras.convertToNeutral(res["to_date"], 'date', "short_date");
    To_Date= To_Date.substring(0,To_Date.indexOf("T"));
    // MRS url hardcoded
    var URL = "kayantech/.../ReportViewer.aspx
    var FullURL = URL + "&rs:Command=Render&"+"FromDate=" +From_Date+ "&ToDate=" +To_Date;
    var w = window.open(FullURL);
}
return "<html></html>";

alert(res) gives me undefined

 



edonahue - Monday, October 10, 2016 4:12 PM:

Hi R,

There is an Aras Labs project that may help you with your use case. You can fork or download the import package at https://github.com/ArasLabs/custom-modal-dialog and use the code as a guide.