Frequently Asked Questions v2 |
FAQ Main / Answer Detail |
Constants and Categories
Author: Honza and Jakub actionapps@ecn.cz |
|
Some fields have a predefined set of possible values --- a constant group. These are usually shown in a select box, multiple check / radio boxes etc. Edit them in Slice Admin -- Fields -- Constants -- Edit / New.
Categories are constants with some special properties. The constant table structure is:
CREATE TABLE constant (
id char(16) NOT NULL,
group_id char(16) NOT NULL,
name char(150) NOT NULL,
value char(150) NOT NULL,
class char(16),
pri smallint(5) DEFAULT '100' NOT NULL,
PRIMARY KEY (id),
KEY group_id (group_id)
);
For example the "State" select box (if you want to see it on input form) has the names and values of:
Name | Value |
Approved bin | 1 |
Holding bin | 2 |
Trash bin | 3 |
Another example, more real-life - colors select box. There can be names of "Red", "blue", "very bright green", ... and values will be "#FF0000", "#0000FF", "#EEFFEE". In input form you see Red... and on page is then #FF0000
The third example is kind of hint. Suppose you want to have different kinds of item - for example "public", "private", "other" and you want to see this words on compact view. No problem, but you want to see each in different color. So you can define:
name: PrivateYou can set the priority order in the constant editing page, and then if you want the output in this order as well, then in the View set the sorting to be "Ascending (or Descending) by Priority"
Usually if you change a constant value, the current items in the database remain the same. By checking this box you force the changes to be made on the items too. If you change "red" to "cyan", all items with color "red" will be changed to "cyan".
Remember that the constants may be shared by several slices --- if you change a value, the changes may be propagated to some places which you didn't count with. Another danger is that if there were some items with "cyan" before, you can never ever find which item are converted from "red" and which are not.
Changing the constant name doesn't have any effect in the database but changes the look in all Edit / New item pages using the constant group.
_#NAME###_ | const_name | Constant name |
_#VALUE##_ | const_value | Constant value |
_#PRIORITY | const_pri | Constant priority |
_#GROUP##_ | const_group | Constant group id |
_#CLASS##_ | const_class | Category class (for categories only) |
_#COUNTER_ | Constant number | |
_#CONST_ID | const_id | Constant unique id (32-haxadecimal characters) |
_#SHORT_ID | const_short_id | Constant unique short id (autoincremented from '1' for each constant in the system) |
_#DESCRIPT | const_description | Constant description |
_#LEVEL##_ | const_level | Constant level (used for hierachical constants). If you want to display hierarchical constants in its hierarchy (so constant on second level have two spaces before the name), you can use following AA expression:{switch({_#LEVEL##_})1: :2: :3: } |
|
Last Edit: Aug 17 2011
<aafaq id=1771> ~ToDo: 1771 Constants and Categories </aafaq>
This FAQ interface was developed by Jason at Commons.ca
|
APC
ActionApps is a free software content management system initiated by
the Association for Progressive Communications (APC) APC - Internet and ICTs for social justice and development |