AnsweredAssumed Answered

Counting filesize of containers with custom function

Question asked by JamesPeragine on May 7, 2017
Latest reply on May 9, 2017 by fmpdude

I am setting up a script that counts the filesizes of the files in the containers of related child fields.  I currently have calculation fields in each of the related records that gets the FileSize using


GetContainerAttribute ( Statement ; "FileSize" )


and then summing them with a calculation field in the parent table


Sum (Merchants_BankStatements::_cFileSize)


I'm trying to set this up instead with a custom function that uses lists and recursion but I can't figure out how to do it.  Here's what I have so far for my custom function.  What am I doing wrong? The number that it's returning is way too big.


ProcessRecursively (theList ; start)


Let ( [

  $i = start + 1 ; // initialize counter

  curVal = GetValue ( theList ; $i ) ;

  result = curVal  // process somehow, e.g. multiply

  ] ;


  Case (

    $i    ≤  ValueCount (theList) ; result +

    ProcessRecursively ( theList; start +1);  )



I'm calling the function like this BTW


ProcessRecursively (List (Merchants_BankStatements::Statement ; 0))