Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi Guys,
When using the data filter widget is there anyway to limit the fields that are able to be chosen for filtering. As a data table has fields automatically created (source, location, key, etc) I think the end user will find them distracting if they are not in use. For instance do we need to have the location field as an optional search criteria when location is not being used at all.
Regards, Kim
At this time, the DataFilter widget can only work with the full set of parameters that are described in the DataShape of the service it's filtering for. You could create a new streamlined DataShape and associated service which uses it to eliminate the unwanted fields.
Andy, my DataShape only has 3 fields but when it's associated with the DataTable then I get all the DataTable fields as well. So are you telling me to create a new service in my DataTable Thing to query and return only the DataShape fields? Or are you telling me to create a whole new Thing that is not associated with a DataTable and add get and query services to that? Or am I completely off target?
If you really need to 'hide' the extra (for free) fields in the UI then I would add a service to the DataTable itself, it's output being the original 'lean' DataShape. Then simply have a script handler like this:
var params = {
infoTableName : "InfoTable",
dataShapeName : "MyDataShape"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(Undefined)
var result = Resources['InfoTableFunctions'].CreateInfoTableFromDataShape(params);
var params = {
maxItems : 500
};
var dataTable = me.GetDataTableEntries(params);
for each (row in dataTable.rows) {
var data = new Object();
data.field1 = row.field1;
data.field2 = row.field2;
//<etc>
result.AddRow(data);
}
I suppose in your case you would use QueryDataTableEntries and pass in the query from your filter widget...but I'm sure you get the idea...
Thanks Andy, I will give it a go