Forum Discussion

spinaka's avatar
spinaka
New Contributor III
4 years ago
Solved

Cumulative sum of a value in an array

Hi Everyone, I need help on an expression solution. The “sum” should be the sum of the value(s) of “key2” from previous records till the current record within the array. I’m trying to make it usi...
  • Aleksandar_A's avatar
    3 years ago

    Hi @manohar.

    In the example you have listed, If i understand correctly don’t we also need to include the filename: Coupa_Supplier_SB_Tax_Cert_PO_4501888888? Because it exists in the docname array?

    If yes, then you can use the following expressions:

    $docname.filter((x,ind,arr) => $filename.indexOf(x) != -1)
    $docid.filter((x,ind) => $filename.indexOf($docname[ind]) != -1)
    $docext.filter((x,ind) => $filename.indexOf($docname[ind]) != -1)
    

    Let me know if this helps.

    BR,
    Aleksandar.