ian.moree

Breakdown of a MASSIVE calculation

Discussion created by ian.moree on Mar 19, 2012
Latest reply on Mar 21, 2012 by sporobolus

Hello Experts and Other FM Enthusiasts.

 

Hopes this gets at least a little answer.

 

I am trying to decipher how & why this works and would like any help that can be offered/ advised please.

 

thanks in advanve,

 

-ian

 

[CODE]

// ChargeFoundSet ( FieldNameList ; LockUnLock ) _v1.0 - not a CustomFunction but a CustomField

// @ Agnès.

 

// Get ( FoundCount ) ≤ 60000

 

 

Let ([

 

 

// --------------- parameter

/*

FieldNameList can be : IDRecord

FieldNameList can be : Get ( RecordNumber ) & ". " & IDRecord & " " & FirstName & " " & Name

FieldNameList can be : GetNthRecord ( MaTable::X ; 1 )

FieldNameList can be can calculation fields etc... */

 

 

FieldNameList = Case ( Get ( LayoutName ) = "ListeNP" ; IDRecord & " " & FirstName & " " & Name ; IDRecord ) ;

LockUnLock = Lock // if LockUnLock are 1 : not calc. not list.

 

 

] ; // ------------------- Calcul --------------------------

 

 

Case (

LockUnLock <> 1 ;

 

 

Case (

Get ( RecordNumber ) = Get ( FoundCount ) ;

Let ([

$n = - 1 ;

$rc = ¶ ; //declare 2 variables local $n & $rc

End = Floor ( Get ( FoundCount ) / 150 ) ; // becomes 10 here

//GetNthRecord ( fieldName ; recordNumber ) //main function

Calc = "GetNthRecord ( ChargeFoundSet ; let ( $n = $n + 150 ; $n ) ) & $rc &" ;

Eval = Case ( End > 0 ; Substitute ( ( 10 ^ end ) - 1 ; 9 ; Calc ) & """" ) ;

CFSResult = Evaluate ( Eval )

];

Case ( Filter ( CFSResult ; ¶ ) = CFSResult ; "" ; CFSResult ) ) )

&

Case (

Get ( RecordNumber ) ≤ 1 or Mod ( Get ( RecordNumber ) ; 150 ) = 0 ; FieldNameList ;

GetNthRecord ( ChargeFoundSet ; Get ( RecordNumber ) - 1 ) & Case ( not IsEmpty ( FieldNameList ) ; ¶ & FieldNameList )

) ) )

[/CODE]

 

Message was edited by: ian.moree

Outcomes