calculation of hours performed

Comments

10 comments

  • Rainer Grabowski

    Hi Claudio,

    what do you mean by "hours worked up to that date."? What are the parameters?

    Rainer

    0
    Comment actions Permalink
  • Claudio Calabrò
    App A Course
    App B Course (related App A), Star dates, End Date, Hour, Progressive.
    
    I need to calculate the Progressive field.
    
    I enclose a table for clarity



    0
    Comment actions Permalink
  • Rainer Grabowski

    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 like

    var 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(" | ")];
    };

    0
    Comment actions Permalink
  • Claudio Calabrò
    maybe I explained myself badly.
    I would like to know how to calculate the progressive field in APP B.
    0
    Comment actions Permalink
  • Claudio Calabrò

    Hi,


    I tried to use the code you showed me but I can not see how I would like to. The progressive field should display 4 8 12 16 20 while I currently display 20 4 12 8 16. Below the screenshot of the code and the result

     

    1
    Comment actions Permalink
  • Bajarang

    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

    1
    Comment actions Permalink
  • Rainer Grabowski

    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. 

    0
    Comment actions Permalink
  • Claudio Calabrò

    I made the changes, but I have not had any improvements.

    0
    Comment actions Permalink
  • Claudio Calabrò

    Hello, I've been working on this code for a few days. Can someone help me? Thank you

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk