Avoid creating duplicate items in list when importing from a versioned module

I have a process that creates keys and values in a list based on if a key has a non-zero value in a source module.

The source module is versioned and some key value pairs could be zero for some versions and non-zero for others. The list finally has to have all key value pairs that have non-zero values in at least one version.

Based on how the version module is set up, I am unable to write a filter (using RANK) to show only the first instance of the key because the filter resets for every version. Therefore multiple instances of the same key (depending on the number of versions) get loaded into the list. It gives a duplicate item message every time the action that does this is run.

Is there any way to avoid this message? The action says it has run with errors but it is not really an error as there are no failures.

Best Answer

  • Dikshant
    Answer ✓

    @klameer - Try to use this kind of rank in your source module. My example has Employee x Versions and users have added similar values in multiple versions.

    Rank: RANK(1, ASCENDING, SEQUENTIAL, Amount <> 0, 'Emp+Amount')

    Try this out and see if it works for you! Let me know if you need more explanation on the approach. But a similar approach for your module with some twists must work.

Answers

  • Hi @Dikshant,

    Thanks for the response. I tried it and it works! Not really sure why though. Doesn't the RANK function reset for every new version?

    Karim

  • @klameer - The line item Emp+Amount used in the RANK function ranks each individual unique combination of employee and amount across multiple versions. SEQUENTIAL in RANK function will make sure if there is same combination across multiple versions, it will give it sequential ranking 1,2,3 and so on. So here our ranking is grouped amongst each emp + Amount combination. But glad it works for you 😉

  • Thank you.