Today’s blog is going to go into a little more detail on how to use the new methods available for Strings in the EDM Expression builder. The 3 new methods that we will cover were released in the 21.12 patch (December 2021). Apologies for being late on reporting this news – it has been a busy 2022!

Today’s Expression examples will be used on this fun example using a Universal Adapter – this is a hierarchy of Oracle products:

String Method: IndexOf

The first method we’re going to cover today is IndexOf. From the 21.12 release notes:

IndexOf – returns the position of a string in a list of strings

Let’s use it in an Expression… in this example, I want to return an integer with the placement (or Index) of a sibling to a node name EDM.

In this example, you can see the nodes under ERP are returning a -1, this is because they do not have any siblings named EDM.

Under the EPM parent, we have some different results:

  • ARCS, EPBCS, and PBCS are returning a 2
  • EDM is returning a -1
  • FCCS and EPRCS are returning a 3

If you put the siblings of ARCS into an array, and start counting from the top at 0, you can see why it would return a 2 for a sibling named EDM:

EPBCSPBCSEDMFCCSEPRCS
01234

If you did the same exercise for FCCS, and started counting at the top starting at 0, this is why it would return a 3 for a sibling named EDM:

EPBCSEPBCSPBCSEDMEPRCS
01234

And of course, because EDM does not have any siblings named EDM… it returns a -1.

String Method: Intersect

The next string method is Intersect. Here’s the definition of what it does:

Intersect – compares two string lists and returns the values which exist in both lists

In an Expression, I want to compare two UDA list properties, and return where they have the same selection:

Here’s the results:

You can see in this example, I have UDA1 and UDA 2 and the Intersect of them in the hierarchy panel for ease of testing.

  • For OFCGL
    • UDA 1 and UDA 2 have no values in common so it returns blank
  • For PRC
    • UDA 1 and UDA 2 both have selections of A and C, thus the intersect returns A and C
  • For PMO
    • UDA 1 and UDA 2 both contain a C, the intersect property returns a C, but ignores the D from UDA 1 and B from UDA2
  • For RMC
    • UDA 1 and UDA 2 both contain an A, so the intersect property returns an A. It ignores the B from UDA 2.

String Method: Reverse

The last string method I’ll cover today is Reverse. This one is pretty straight forward:

Reverse – returns a list of strings in the reverse order

This Expression will look at parent values and return their list of children in a bottoms-up order (reverse). Note, we start with an “If” statement so it only calculates on nodes that have children (children.any = True), and do not return anything for base-level nodes (the “else” statement returning null):

In EDM, you can see the parents will return a list of their children, starting at the bottom and ending at the top:

So as an example, the ERP parent is returning the children in the reverse order they appear: RMC, PMO, PRC, and OFCGL.

Also I included in the screenshot that you can see the Reverse Example property is derived/calculated (not hard coded by me :))