I’m trying to build a report table that generally looks like a Notes view. The first few columns all come from a simple customer list view. The next column is to be a total calculated by adding up a particular field on documents related to that customer within the date range. The final column is a calculation of monthly bill (a simple view column) divided by total hours (the computed column).
So obviously the way to go about this is a repeat control, and I have my simple view columns working fine. What would be the best way of tackling the other two columns? Can anyone give me any links to examples of something similar to this?
I was thinking of trying to invoke an agent via an AJAX call and returning the data via a print statement, but is there a better way?
Subject: Dynamic Report Column
You will be able to do it with javascript to compute the values. From your repeat control you can specify the var for each row, which will gives you an XspViewEntry. From that you will be able to use XspViewEntry.getDocument() to get the back-end document, so you will be able to get the relevant field values and do your calculations.
Alternatively, if you can do the calculation in your Notes column, you can just display the column value. However, doing the calculation in javascrip on the fly will probably give better performance and minimise view index size.
Hope that helps
Paul
Subject: Dynamic view column
The row data is from a whole other view, so I can’t just use the reference I already have. Out of the Contracts view and the Work view, I’m trying to produce something like:
Start Date: XX/XX/XXXX
End Date: XX/XX/XXXX
Period: (calculate number of days between start and end)
Cust ABC | $10k/month | 300 hours | $33/hour
Cust XYZ | $5k/month | 100 hours | $50/hour
Where the 300 hours is the sum of hours on each work document in the date range for that customer, and the $33/hour is the result of (monthly rate * 12 / 365) * (number of days) / (number of hours).