Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi,
How to pass an ACL array in a javascript function and how to read the array in the javascript function ?
David
Solved! Go to Solution.
I have found the solution in Arbortext Documentation(Arbortext Programmer’s Reference):
Similarly, there are two ways to retrieve an ACL array from JavaScript. The first method uses the ACL join function to concatenate the ACL array into a string that initializes a JavaScript array. For example, you can use the following ACL code to pass the ACL array created above to JavaScript:
javascript("var jsArr = [" . join(aclArr) . "]");
This method is not limited by the ACL string token limit.
You can also use a loop to retrieve the array, element by element, as shown in the following JavaScript example:
var count = parseInt(Acl.eval("count(aclArr)"));
var lowBound = parseInt(Acl.eval("low_bound(aclArr)"));
var jsArr = new Array(count);
for (var i = 0; i < count; i++) {
var ai = lowBound + i;
jsArr[i] = Acl.eval("aclArr[" + ai + "]");
}
This method translates the arbitrary array index bounds in an ACL array to the zero-based array index in JavaScript. It also uses the parseInt method to convert the Java string returned by Acl.eval into a JavaScript number.
I have found the solution in Arbortext Documentation(Arbortext Programmer’s Reference):
Similarly, there are two ways to retrieve an ACL array from JavaScript. The first method uses the ACL join function to concatenate the ACL array into a string that initializes a JavaScript array. For example, you can use the following ACL code to pass the ACL array created above to JavaScript:
javascript("var jsArr = [" . join(aclArr) . "]");
This method is not limited by the ACL string token limit.
You can also use a loop to retrieve the array, element by element, as shown in the following JavaScript example:
var count = parseInt(Acl.eval("count(aclArr)"));
var lowBound = parseInt(Acl.eval("low_bound(aclArr)"));
var jsArr = new Array(count);
for (var i = 0; i < count; i++) {
var ai = lowBound + i;
jsArr[i] = Acl.eval("aclArr[" + ai + "]");
}
This method translates the arbitrary array index bounds in an ACL array to the zero-based array index in JavaScript. It also uses the parseInt method to convert the Java string returned by Acl.eval into a JavaScript number.