anne - Thursday, September 5, 2013 11:26 AM:
Hello all:
I am pretty new at Aras programming and I am trying to apply a filter to a form field. So, to describe:
I have a field on a form that is of type Item whose source is the ItemType Customer. It shows up as a textbox with three dots next to it. Clicking the three dots brings up a list of customers from which the user can choose. What I want to do is filter this list by field called "k_potential_client" which is a Boolean type. I want to omit customers that have a check mark in this field from the list that comes up when the three dots are clicked.
I have tried several varieties of javascript methods and attached to the field event "on focus" on a form. I'm not sure if this is the problem, or if the filter simply is not coded correctly. Here's what I tried:
var Filter = new Object();
Filter["k_potential_customer"]={filterValue:"0", isFilterFixed:true};
return Filter;
I also tried (error checks omitted):
var innovator = new Innovator();
var client_field = document.getElementById("so_customer");
var clientItem = innovator.newItem();
clientItem.loadAML("<Item type='KIHOCAL Customer' action='get' select='k_name, k_main_phone, k_contact_name, k_potential_customer, id'>" +
"<k_potential_customer condition = 'eq'>" + "0" + "</k_potential_customer></Item>");
var clientResult = clientItem.apply();
return clientResult;
Can anyone tell me how to apply this filter to the field so that the list that comes up is filtered?
Thanks so much for any help.
Anne
zahar - Thursday, September 5, 2013 12:00 PM:
Anne,
The solution for what you want is:
- Go to ItemType management, open your ItemType
- Find your property that connected to ItemType Customers
- Right Click "View Properties"
- Lock
- In Event tab add a new line
- In Event Column select "OnSearchDialog"
- Attach your own Javascript to this event
Search for similar methods for detailed code that need to be used in this method
anne - Thursday, September 5, 2013 12:12 PM:
Chernov,
Thank you so much. This worked perfectly!
Anne