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 - Filtered Item Browser with empty results possible

newcomer - Wednesday, May 23, 2012 6:00 AM:

Hi all,

I m using the filtered item browser(http://www.aras.comhttp://www.aras.com/Community/wikis/kb/filtered-item-browser.aspx) to  restrict the Items that a user could select. This solution has a problem (which is also mentioned in the post) when the idList is empty. Then there will be an alert window("Error [Object] Object"). But that is exactly what I need. Sometimes there will be no Items which can be selected and the search grid should be empty. Is there a workaround for this problem?

 

var changeRequests = innov.applyAML(amlString);

var idList = new Array();
 
if (!changeRequests.isError() && !(changeRequests.getItemCount()===0))
{
    for (var i=0; i< changeRequests.getItemCOunt(); ++i)
    {
        idList[i] = "'" + changeRequests.getItemByIndex(i).getProperty("id") +"'";
    }
 
     //Return selectable items here... 
    inArgs.QryItem.setCriteria("id",idList.join(","),"in");
   
}
else
{
    //Return/Set empty result here...
}

 



Brian - Thursday, May 24, 2012 9:54 AM:

Hi,

In the event of an empty data set you want to set the idlist to the following and then return ("");

inArgs.QryItem.item.setAttribute("idlist","00000000000000000000000000000000");

that should get around the error message and return a filtered item browser that has no results and cannot be edited by the user.

Hope this helps,

Brian.



newcomer - Friday, May 25, 2012 2:57 AM:

This works. Thanks Brian.