# Calculate %dissolved in older version CDS

Hi all,

Recently, I have been create report template for a dissolution method. I have figure out how to handle vessel number = 6, but they also want me to create report for vessel number = 12. Since we needed add withdraw amount from previous timepoint,

I've been using a lot variables to sum all the withdraw together and then perform the dissolution calculation. It works for vessel number = 6, but with vessel number = 12, there are way too many variables that one template can handle.

Are there any other ways to report %Dissolved?

Thank you for any help!

Version of my CDS:

%Dissolved Calculation:

Report template I have created for N=6: This report probably works for n=12, just add 6 more column to each table, but this way too time consuming and too many variable will cause the CDS extremely slow.

• Hello,

This is much easier using the CDS 2.x software since the custom calculator has mechanisms to allow this type of summation directly. If had to do this in IR, I would likely use a custom dll to create a function to store and sum the values from previous timepoints. You can also do a similar operation with an array directly in custom code. In simple example below, I built an array of compound results indexed by injection ID +compound name and then the clues back later by that same index in another function. In this case, I used this code to replace several stored variables and hidden tables in a report where I want to have multiple compound results in the same table row. You should be able to do something similar where you store the results from each table in an array and then use a function to call back the sum from the array in the next table. What would have taken several filtered hidden tables and keyed variables, takes one column in one hidden table.

'Dimension Variables
Public Dim MyArray(5,1) as Object
Public Dim rows as Integer = 0
Public Dim test as Integer = 0

'Naming Function and sending values to fill array by injection id and compound name
Public Function FillArray(ByVal InjIdCompName As String,ByVal Value1 as Double, ByVal Value2 As Double, ByVal Value3 As Double,Optional ByVal Value4 as Double = 0) As String
'Filling Array
rows = Ubound(MyArray,2) + 1
Redim Preserve MyArray(5,rows)
MyArray(1,rows) = InjIdCompName
MyArray(2,rows) = Value1
MyArray(3,rows) = Value2
MyArray(4,rows) = Value3
MyArray(5,rows) = Value4

Return "Complete"

End Function

'Function to call back value from array
Public Function UseArray(ByVal InjIdCompName As String, ByVal DataCol as Integer) As Double
Dim Value as Double = 0
Dim rowcount as Integer
rowcount = Ubound(MyArray,2)
For index As Integer = 1 To rowcount
If MyArray(1,index) = InjIdCompName
Value = MyArray(DataCol,index)
End If
Next

Return Value

End Function

• Thank you so much for your help!

But, how does the custom code reference to the table in the report template?

Please correct me If I'm wrong, I think the string parameter "InjIdCompName" in the "Fillarray" function is the table or column name in the template.

Software will automatically pass table or column name with "InjIdCompName" into the "Fillarray" function.

Am I on the right track?

• Hello,

You can see below where I call the function and pass it the value for each row in the table. In my example, the function accepts up to 5 values per line to add the multidimensional array. When that hidden table is processed each line adds a row to my array that contains values I am passing. In the second table, I use the second function with an index based on the compound name and injection id along with an array column index to pull back specific values. If you have custom code in the report the functions will show up in the expression editor.

Marty

• Understand, thank you so much Marty!!!!!