Suppose I have an agent query that uses a specific Attribute as a search criteria.
I know I can change that Attribute within the Defined Attributes inspector.
But if want to make this a bit more user-friendly for others, is it possible to define the agent so an input box appears just as when entering data on any app or website?
Just so we’re on the same page, I assume you mean the Displayed Attributes table? If, not, other places you can check change the agent’s query (stored in attribute AgentQuery):
Get Info pop-over or tear-off, attributes panel. This is essentially the same ‘table’ as you see in Displayed Attributes and where you can display the $AgentQuery value. Unless your query is shot, neither this not Displayed Attributes are the ideal place to edit the entire query.
Get Info pop-over or tear-off, agent panel. This is the UI you see when you first create an agent.
The run of the text suggests you want to change the value of that attribute which is embedded in the query. So for example, you may have the query:
$Prototype=="pType & $MyType=="car"
But we instead of ‘car’ we now want to search for the value ‘plane’. Easily done! Fist add $MyType (substitute the name of your actual attribute in your own doc) as a Displayed Attribute. Now edit the query:
$Prototype=="pType & $MyType==$MyType(agent)
Now, set ‘plane’ as the value of the agent and the query updates. $MyType(agent) is saying "use the value of MyType as stored in this agent. Change the agent $MyType to ‘boat’ and you’ve changed the query again.
In the example above I’ve used the same attribute for the agent value as is being tested. this makes it easy to set the agent Displayed Attribute value using the op-up list of already used values for that attribute. But, what if we didn’t want the agent having MyType using a value as it meant counts of value usage would be off by 1? No problem, we can use a different attribute. For instance, we add MyString to the agent’s Displayed Attributes and change the query:
$Prototype=="pType & $MyType==$MyString(agent)
Set the agent MyString to ‘car’ and you should get the same result as in the original query.
TL:DR— use the Action Inspector to view edit the query as a whole (the Inspector is easily shown/hidden toggled by shortcut Cmd+1. To re-use the same queries with different values of a specific attribute, use the last pair of examples above.