If item is contained in list

Occasional Contributor

If item is contained in list

I was reading this and on the EXAMPLE section,

there is a IF condition as below;

IF ITEM(Products) = Products.Widget
THEN <... calculation for Widget ...>
ELSE <... calculation for other products ...>

This made me wonder, does Anaplan automatically compares each items within the list?

In Python term, I am thinking Anaplan is acting as below:

item = ["parent", "code", "widget"]
if
"widget" in item: print "it matches!"

Is this correct?

Thanks,

Message 1 of 3
2 REPLIES 2
Community Boss

Re: If item is contained in list

Hi,

 

Anaplan doesn't automatically compare (in a literal sense)... so there a recurring need for IF-THEN logic.  However, we can say the following:

  • Items in lists are known by Anaplan and there are some default behaviors that Anaplan takes in relation to them.  Most prominently, Anaplan aggregates data based on dimensions.
  • With respect to IF-Then logic, we do see cases where we have to ask questions about items in a list (like you have in your example).  In these cases, the IF-Then logic is akin to something we'd code using a programming language (but the syntax is simpler). 
  • Anaplan can fetch list relationships without IF-Then logic. 
    • The simplest example is the value of a property:   Employees.Location (we don't have to ask anything about the Employees list... we can fetch the attribute directly because the list is included in the module)
    • Other mappings can be more complex, using combinations of list relationships, or lookups.

Does this help?  

 

Paul

Message 2 of 3
Contributor

Re: If item is contained in list

Hi @julio.harada,

The python code that you wrote does search the whole list and gives you TRUE OR FALSE with those that have matched. 

Whereas, in Anaplan, it goes line by line. Nearly, what python does. However, there are certain limitations to it. Anaplan always does the search line by line. So, if ITEM(PRODUCTS) = Products.Widgets THEN TRUE ELSE FALSE. If your goal is to compare one product or one parent with another product within the list, then you have to employ different methods to it and it varies on the use case.

 

So to speak, yes Anaplan does search what you have mentioned, line by line. If you are looking for a bulk search then there are workarounds to it. Let me know if there are such use cases that you want help with. I can certainly help you. Post it here and surely I will get back to you.

 

Regards,

Adithya S 

Message 3 of 3