calculation of hours performed
Hi everyone,
I have an App that contains the calendars of all courses with Course, Start Date, End Date and Duration (End minus Initial) Calculated.
I would need a calculation on the item that I calculate the hours worked up to that date.
Thank you
-
Sorry, but not sure if I understand you correctly. Do you want to create a table in App A with data from all related items in App B?
If so do you have already a calculation with a for loop? If so you can do something likevar course = @all of course;
var start = @all of start date;
var end = @all of end date;
var hrs = @all of hours;
var rows = [];
var prog = 0;
for( i = ....){
prog += hrs[i] || 0;
rows.push([course[i],start[i],end[i],hrs[i],prog].join(" | ")];
}; -
Hi Claudio,
For implementing this you need to
1) Create a new calculation field in app A which consolidates all the App B data as json.
2) While consolidating the data you need to sort all the related app B items and calculate the progressive value and store in the same json.
3) After that, you need to create a new calculation field in app B and use the above consolidated json and display the progressive field.
You need to do a couple of calculations but using the above steps you can achieve this.
- Bajarang -
Hi Claudio,
sorry, I had a typo in my code: instead of a dot between hrs[i] and prog there must be a comma. Means for your code: Replace the dot between Ori[i] and prog with
+ " | " +
Also there are 2 mistakes in your code:
a) When you use @all of with nulls you should call the array elements for the arrays with nulls with [i][0], not only [i].
b) In the IF-line in your screenshot the { bracket for the if clause is in the wrong place. It must be directly behind the closing ) of the if clause: if(.... "Tutto"){@Bajarang
Yes, JSON is my preferred tool for calculation fields too, it has so many advantages. But I think it's too sophisticated for beginners. And I think Claudio will get the right progressive numbers when he updates his code.
Please sign in to leave a comment.
Comments
10 comments