Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
protogrid:agents [2020-04-22 09:22] – [Example] jus | protogrid:agents [2020-12-22 16:31] – Best-Practices für grössere Berechnungen gemäss KitAjour-Design-Review eingefügt. dru | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Agents ====== | ====== Agents ====== | ||
- | |||
Agents run periodically and execute code specified by the user. | Agents run periodically and execute code specified by the user. | ||
Line 6: | Line 5: | ||
===== Setup ===== | ===== Setup ===== | ||
- | |||
To set up an agent, there are two necessary steps: | To set up an agent, there are two necessary steps: | ||
* Under Design -> Code, create an Agent Library and add your code to the // | * Under Design -> Code, create an Agent Library and add your code to the // | ||
Line 18: | Line 16: | ||
- Based on this proto, create some cards where the date lies within the next 60 minutes. Wait one hour. | - Based on this proto, create some cards where the date lies within the next 60 minutes. Wait one hour. | ||
- The value in your Text Field should have been replaced by //Frist abgelaufen.// | - The value in your Text Field should have been replaced by //Frist abgelaufen.// | ||
+ | |||
<code javascript> | <code javascript> | ||
function agent_library() { | function agent_library() { | ||
- | var defkey_status_field = " | + | var defkey_status_field = " |
function set_value(card, | function set_value(card, | ||
Line 46: | Line 45: | ||
===== Execution ====== | ===== Execution ====== | ||
+ | Agents are checked every hour. If any DateTime Field on a card has a smaller value than the current time and the Agent has not yet run since that time, the Agent gets triggered and the code in the Agent Library is executed in the context of this card (for Date-Only Fields, the time taken into account is said date, 00:00 GMT). Agents run in the context of a specific user profile. This user's password is automatically reset during the execution process. So this user profile shall only be used for agents and not for physical users. All agent executions are logged in the // | ||
- | Agents are checked every hour. If any DateTime Field on a card has a smaller value than the current time and the Agent has not yet run since that time, the Agent gets triggered and the code in the Agent Library | + | ===== Best Practices for Calculation Code ====== |
+ | In the following, we have compiled some recommendations based on our experience for high stability, performance, | ||
+ | - It is recommended to use [[protogrid: | ||
+ | - Note: Use multi column indexind views at all only if the free combination of several filters is required in the user interface. | ||
+ | - Write to as few Relation Fields as possible | ||
+ | - Procedure if the calculation code requires a " | ||
+ | - If editing or deleting a Card in the user interface subsequently to calculation has to be prevented, this can be done in both cases by restricting the editing rights ([[protogrid: | ||
+ | - Read/load as few specific/ | ||
+ | - Analogous to the previous point, write as few specific/single cards as possible. Whenever possible, save several cards together. You can use the Endpoint [[protogrid: |