Register

Error when updating hierarchies with list items

fredrickstraube
Frequent Contributor

Error when updating hierarchies with list items

I'm trying to update a list hierarchy from a module, which I have updated with an import file, and everything seems to be working just fine, that is, my list items are updated. However, since I have the same list item occurring several times in my import file, and also in the module I import from, I get the error message "Another row has already been processed with this key" and then the yellow warning triangle. 

 

Does anyone know how to avoid this? I don't want my client to think that there is an error in the import when it actually worked just fine. 

 

Thanks a lot!

16 REPLIES 16
alexpavel
Certified Master Anaplanner

Re: Error when updating hierarchies with list items

Hi, 

 

You can create a boolean line item and use FIRSTOCCURRENCE function to identify only the distinct elements and codes to update the list. 

Create a saved view with the filter based on the boolean line item and use it as a source for updating the list. 

 

Hope it helps!

 

fredrickstraube
Frequent Contributor

Re: Error when updating hierarchies with list items

Hi Alex,

 

Thanks a lot for your reply. However, I'm not sure if this would work for me, since I am trying to update 5 lists from one module, and as far as I understand, ISFIRSTOCCURRENCE can only be used when you have the list you want to update as dimension. Or am I wrong?

 

Thanks!

alexpavel
Certified Master Anaplanner

Re: Error when updating hierarchies with list items

Hi
Yes, indeed firstoccurrence function works for 1 dim at the time.
This is why you will need to create a boolean and a saved view for every of 5 lists that you need to update.

Cheers
Alex
rob_marshall
Moderator

Re: Error when updating hierarchies with list items

@fredrickstraube ,

 

Check out this training video (305 Hub Model Hierarchy Management)

 

https://learning.anaplan.com/enrol/index.php?id=419

 

Thanks,

Rob

fredrickstraube
Frequent Contributor

Re: Error when updating hierarchies with list items

Thanks a lot for this, but it seems like an extremely complicated solution. Do you know if there is an easier way to do this?

rob_marshall
Moderator

Re: Error when updating hierarchies with list items

@fredrickstraube ,

 

The IsFirstOccurrence() function works on the list within the source module, not the target list.  For example, you have a transaction module using Trans List as your list, but you want to find the first occurrence of a line item (Product) to be used in several lists downstream.  The formula would be isfirstoccurrence(Product, Trans List) which can be used as a filter for your other views.

 

Does this help?

 

Rob

fredrickstraube
Frequent Contributor

Re: Error when updating hierarchies with list items

Hi Rob,

This is exactly what I needed and it works perfect!

Thanks a lot for your help!

svbhagat
Contributor

Re: Error when updating hierarchies with list items

Hello @rob_marshall ,

Thank you for this solution.  I'm trying to use this logic but I have an extra layer that I would like to review.  

 

I have a System Module in my Data Hub Model where I am bringing in all Hierarchy levels as well as Boolean Line Items for the Subsets I would like to build in my list.

My System module is built off of a Full Account Flat List.  I've created a line item for the AU Number from that.  This AU Number shows up multiple times due to the different Accounts it is associated with.  I then have Boolean Line Items to select based on the Accounts.  

 

I'm trying to build a list for the AU and have Subsets that should be populated from the Boolean Line Items in the System Module.  But because the List gets populated based on the first occurrence of that AU, the Boolean for the subsets are not getting populated correctly.  

What additional logic could be added to resolve this issue?

 

Here is a screenshot:

System Module:  As you can see the Salary and Other Expense are Account lines for the same department.  The Printing Boolean is only selected for the Printing Account.  But because Salary is the first occurrence, the Printing Boolean is not getting populated when I create the list subset.

svbhagat_1-1612993203764.png

List:

svbhagat_2-1612993268441.png

Thanks

rob_marshall
Moderator

Re: Error when updating hierarchies with list items

@svbhagat 

 

Ok, yes, yours is a bit more complex, but still very doable.  Is that 750 (the AU number) a list or text formatted?  If it is not a list, I would create a flat list in your data hub of just the first occurrences of that AU Number and then create a line item that is formatted as AU Flat (so a Finditem(AU Flat, AU Number) - name the line item AU Flat List) in that module (the one you were showing, the transactional module).

 

Then, you can create a SYS module based off the newly created list (AU Flat) for the subsets formatted as Boolean.  For for each of the new subset line items, you can use the following formulas:

  • Admin ss: Source Module.Admin ss[ANY:Source Module.AU Flat List]
  • Acqu ss: Source Module.Acqu ss[ANY:Source Module.AU Flat List]
  • Deferred ss: Source Module.Deferred ss[ANY:Source Module.AU Flat List]
  • Allocated ss: Source Module.Allocated ss[ANY:Source Module.AU Flat List]
  • Controlled ss: Source Module.Controlled ss[ANY:Source Module.AU Flat List]
  • Printing Admin ss: Source Module.Printing Admin ss[ANY:Source Module.AU Flat List]

Now, from this SYS AU Flat module, create your views to populate the spoke model.

 

Let me know how it goes.

 

Rob