List Examples
These example calculated attributes are written to use the data defined in the following tables.
For function syntax information and more detailed use cases, refer to the List Functions documentation here.
Note: Text used for 'attribute-id' and 'unit-id' is case-sensitive.
The example value templates require the attributes and values defined in the following table:
ATTRIBUTE Type |
ID |
Name |
AttrDesc |
---|---|---|---|
Embedded number-validated product attribute with length units |
EMBEDDEDNUMBER1id |
EMBEDDEDNUMBER1 |
EMBEDDEDNUMBER1 description |
LOV-validated product attribute |
LOVAttr1id |
LOVAttr1 |
LOV description |
LOV with 'Use IDs on Values' = Yes; and Values =Yes and No |
LOV1id |
LOV1 |
|
Number-validated product attribute with length units |
NUMBER1id |
NUMBER1 |
NUMBER1 description |
Text-validated attribute property |
AttrDescid |
AttrDesc1 |
AttrDesc description |
Text-validated product attribute |
TEXT1id |
TEXT1 |
TEXT1 description |
The example value templates require the products and values defined in the following table:
PRODUCTS ID |
Name |
Parent |
TEXT1id |
NUMBER1id |
---|---|---|---|---|
P-family-id |
P-family |
Product hierarchy root |
family value |
2 m |
P1id |
P1 |
P-family-id |
p1 value |
4 m |
P2id |
P2 |
P-family-id |
p2 value |
5 m |
P3id |
P3 |
P-family-id |
p3 value |
6 m |
After creating the data above, copy and paste any of the Value Template text below into the Function Editor. Select the Object identified and click the Evaluate button to display the defined Result.
Value Template |
Object |
Result |
---|---|---|
list(iterate(subproducts(), 'prodval("TEXT1id")'), ', ') |
P-family-id |
p1 value, p2 value, p3 value |
list(iterate(subproducts(), 'prodval("TEXT1id")'), ', ', ' & ') |
P-family-id |
p1 value, p2 value & p3 value |
list(reverse(iterate(subproducts(), 'prodval("TEXT1id")')),', ') |
P-family-id |
p3 value, p2 value, p1 value |
list(iterate(subproducts(), 'concatenate(index,": ",item)'), '\n') |
P-family-id |
1. com.stibo.core.persistence.NodePO-343239, 2. com.stibo.core.persistence.NodePO-3432395, 3. com.stibo.core.persistence.NodePO-3432395 Note: 'com.stibo.core.persistence.NodePO-3432391,…' are internal representation of the nodes (sub products). This happens when iterating subproducts and displaying them using the default variable 'item.' |
list(iterate(subproducts(), 'concatenate(index,": ",stepid())'), '\n') |
P-family-id |
P1id, P2id, P3id Note: Attribute values from the iterated nodes are displayed when called from inside the iterate function. |
list(list2multivalue(value('AttributeA'))) |
|
value a<multisep/>value b<multisep/>value c Note: multivalue attribute with the values: "value a", "value b", and "value c" |
list(multivalue2list(value('AttributeA')),', ') |
|
value a, value b, value c Note: multivalue attribute with the values: "value a", "value b", and "value c" |
list(sortnumeric(listconcatenate('2', '56', '11', '0', '21', '13')), ',') |
{any} |
0,2,11,13,21,56 |
list(unique(listconcatenate('a','b','a','c','b ')),', ') |
{any} |
a, b, c |
listconcatenate(iterate(subproducts(), 'prodval("TEXT1id")'), iterate(subproducts(), 'prodval("NUMBER1id")')) |
P-family-id |
p1 valuep2 valuep3 value456 |
valuelovid('LOV1Attrid') |
P3id |
LOV1id |
if(listcontains(iterate(subproducts(), 'prodval("TEXT1id")'),"p1 value"), "p1 is present","p1 is NOT present") |
any family other than P-family-id |
p1 is NOT present This is the same formula as shown previously except the list formula is written in full within the LISTCONTAINS function |
listlen(iterate(subproducts(), 'prodval("TEXT1id")')) |
P-family-id |
3 |
listitem(iterate(subproducts(), 'prodval("TEXT1id")'),2) |
P-family-id |
p2 value |
iterate(filter(subproducts(),'prodval("number1id")>3'), 'concatenate("Name = ",stepname(),"; ID = ", stepid(), ". ")') |
P-family-id |
Name = P1; ID = P1id. Name = P2; ID = P2id. Name = P3; ID = P3id. extracts id of all child products where number1id is greater than 3 |
{x := iterate(subproducts(), 'prodval("TEXT1id")') } if(listcontains(x,"p1 value"), "p1 is present","p1 is NOT present") |
P-family-id |
p1 is present this is the same formula as shown following except the variable x is used to separate the list formula |
range(listconcatenate('1','5','8','6','7'), '-') |
{any} |
1-8 |
range(listconcatenate('1','5','8','6','7'), '-', ', ') |
{any} |
1, 5-8 |
sort(iterate(subproducts(), 'prodval("NUMBER1id")')) |
P-family-id |
456 |