Selection filtering returning odd results
We are trying to filter selections from a database based on previous dropdown selections. Normally this is not a problem, but for some reason this time we are getting an odd java based error. I am using schema elements, and calling out to the database to return items into "Time Code" where the Category name = "CatGroup". As a test, I have also created a test box to copy the data string into to verify what it is trying to pass to the query statement.
My rule is set up so that "catGroupTest.value = CatGroup". This is what is passed into the test box: "org.mozilla.javascript.NativeJavaArray@1437b98".
My "CatGroup" & "TimeCode" elements are from a schema. The test box is not.
Any ideas why this is showing this way?
var j, opts, i, x, temp, index = DailyRows.itemIndex;
for (j = 0; j <= index; j++) {
if (CatGroup.value.length > 0)
{
catGroupTest.value = CatGroup.value
eval("x=" + http.get("http://localhost:8082/database/MFC/TimeDescription/category?CatGroup=" + catGroupTest));
opts = [];
for (i=0; i < x.resultSet.length; i++) {
if (x.resultSet[i]) {
opts[i] = x.resultSet[i].TimeCode + "=" + x.resultSet[i].TimeCode + "--" + x.resultSet[i].Description;
}
}
TimeCode[j].options = opts;
}
}
-
I am not sure I completely understand your problem, but looking at the rule I see at least one issue there.
If I am not wrong, then in the http.get statement you need to use 'catGroupTest.value' not just catGroupTest.
Can you try correcting it and then see if the rule works?
0 -
You are right. I did forget the ".value" on the end. I also forgot that my "CatGroup" value was inside of a repeating element and therefore needed my loop variable. Below is my revised code.
var j, opts, i, index = DailyRows.itemIndex; for (j = 0; j <= index; j++) { if (CatGroup[j].value.length > 0) { eval("x=" + http.get("http://localhost:8082/database/MFC/TimeDescription/category?CatGroup=" + CatGroup[j].value)); opts = [ "" ]; for (i = 0; i < x.resultSet.length; i++) { if (x.resultSet[i]) { opts[i] = x.resultSet[i].TimeCode + "=" + x.resultSet[i].TimeCode + "--" + x.resultSet[i].Description; } } TimeCode[j].options = opts; } }
Thanks again for your help!!
0
Please sign in to leave a comment.
Comments
2 comments