Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
configuration:lisanew:optionquery [2016-03-08 12:33] Martin Berg Page moved from configuration:lisanew:optionquery to relnotes:releases:configuration:lisanew:optionquery |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Option Query ====== | ||
- | Option queries are used to give the user a pre-selected set of something to increase usability in the solution. This is typically a relation field, but can also be a text field. Utilizing option queries can greatly enhance the speed in which the user can fill in information. You can see the pre-selected posts if you click on the little arrow next to the field in question. There are no pre-selections made as default. Option queries are made and edited in LISA under the property tab for the field in question in the setting " | ||
- | * Note that this functionality can't handle endless text fields | ||
- | * Note that you cannot use brackets ([ and ]) in the option query code | ||
- | |||
- | |||
- | ===== How to code the queries ===== | ||
- | |||
- | |||
- | |||
- | Option queries have their own special code format that looks similar to SQL, but isn't like SQL. Therefore you cannot paste SQL-code into option queries. The easiest way to understand this is to think " | ||
- | Principally this is true everywhere; [card type you want to show] WHERE [you start from your target - which naturally have to be the same card type as the one before the where command]... and then graphically walking through the solution to what ever criteria you want. Easy peasy! | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | === Show all available choices === | ||
- | |||
- | |||
- | |||
- | |||
- | The most basic idea of an option query is that you want to show all available options (which is not done by default). Simply write a criteria that all is fulfilled for all posts. The query below is read as "show me all cards of the type [coworker] where the ID on that card isn't zero" (which is true for all of them) | ||
- | |||
- | <code dos> | ||
- | coworker WHERE coworker.idcoworker <> 0 | ||
- | </ | ||
- | |||
- | |||
- | |||
- | === Set field as a criteria === | ||
- | |||
- | When you want to show the alternatives that has a certain value chosen in a set field, such as all coworkers that have the option administrators chosen, you simply write as follows. | ||
- | |||
- | <code dos> | ||
- | coworker WHERE coworker.position LIKE ' | ||
- | </ | ||
- | |||
- | |||
- | === Multiple criteria === | ||
- | |||
- | In a lot of cases one criteria is simply not enough. Luckily adding more is easy - simply separate them by AND or OR. | ||
- | |||
- | <code dos> | ||
- | decision WHERE decision.client.idclient = activerecord.client AND decision.decisiontype.name = " | ||
- | </ | ||
- | |||
- | === Unset relations === | ||
- | |||
- | In some cases where you want to set relations (let's say unpicked errands and set them to a specific coworker) you want to show the ones **without** a relation. This is easily done by the code below, where the zero represents an unset relation. | ||
- | |||
- | <code dos> | ||
- | errand WHERE errand.coworker.idcoworker = 0 | ||
- | </ | ||
- | |||
- | === Combine different sets of posts === | ||
- | |||
- | |||
- | If you want to combine two sets of posts that have different criteria you have to " | ||
- | |||
- | <code dos> | ||
- | person WHERE person.company.idcompany = activerecord.company | ||
- | UNION | ||
- | person WHERE person.case.idcase = activerecord.case | ||
- | </ | ||
- | |||
- | === Criteria from listed objects === | ||
- | |||
- | The examples above deal with critera from the sub tabs on the card in question. To make it a bit more tricky here we have related persons to itself via a middle object - thereby creating the possibility to show relations between different persons. What we want to do is show the available options on a history card. Let's start with the person card; it has two tabs; " | ||
- | |||
- | <code dos> | ||
- | persons WHERE persons(customer).seller([tab on customer card]).seller([field on the middle object]).idperson([ID on the seller person card]) | ||
- | </ |