get value from table cache(a,b,c,d)
Group |
Returns the value of column c in the entry with primary key b in the table cache a.
If no value is found, the default value d is returned.
Description of Parameters
Parameter |
Description |
a |
Name of the Table Cache. |
b |
Primary key value (is in the first column). |
c |
Name of the column to be read. |
d |
Default value if no value was found. |
Examples
Assume a Table Cache article with the values {id=100, name=mobile phone, supplier_Id=4711} and the Table Cache supplier with the values {id=4711, supplier_name=The Supplier's Ltd, supplier_country=Ivory Coast}. Note: How exactly to create these Table Caches is described in the documentation of the function create table cache(a,b[,c...k]) .
Now we call our function here.
Parameter a |
Parameter b |
Parameter c |
Parameter d |
Result |
article |
100 |
name |
not available |
mobile phone |
article |
1000 |
name |
not available |
not available |
article |
100 |
supplier_Id>supplier_country |
not available |
Ivory Coast |
In the last line you can see an example of how to retrieve referenced values. To do this, you must first define a reference between the two Table Caches. How to do this is described in the documentation of the function create table cache(a,b[,c...k]).
The entry with the primary key value 100 is retrieved from the Table Cache article. The supplier_Id column of this entry has the value 4711. This column is referenced to the Table Cache supplier (see the documentation of function create table cache(a,b[,c...k])). There the entry with the primary key value 4711 is read and then the value of the column supplier_country. This value is Ivory Coast.