Calculating with changing values (salary) without retroaction

Comments

3 comments

  • Hamid

    Hi Casper,

    My idea is to create a new app behind the two existing 

    Create 'Hourly Rate App' with three fields

    1- Freelancer : Related field to 'Salary App' 

    2- Rate : Number field for Hourly Rate

    3- Status : Category field with two fields, for exemple  "ACTIVE RATE" & "ARCHIVE RATE"

    ** Create a new View with only "Active Rate" status with filtring and saving the view

    PS : in the parameters of Hourly Rate on Display Options make sure to display only the "Freelancer field" in Relationship View

    Now in your "Assignement App"  

    First field will be a relationfield to the 'Hourly Rate App' with only "ACTIVE RATE" (The view created)

    Change your calculation field to the new fields and that's it.

     

    PS : In the "Salary App" delete de hourly rate field (its just a contact app)

    Good Luck

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi,

    there'sa way w/o an additional app:

    Instead of a number field or a money field for the hourly rate in the Salary App take a single line text field, name it e.g. "Rate History". Enter each rate change in this format: YYYYMMDD:new rate; should then be something like this: 20161101:45;20170301:50

    I assume, you've a date field in the Assignment app (maybe a deadline date or a creation date).
    In the calculation field in the Assignment app enter:

    var assDate = moment(@Date field).format("YYYYMMDD");
    var assDate = Number(assDate) || 0;
    var hrs = @working hours;
    var history = @All of History.join().split(";").reverse();
    for(var i = 0; i < history.length; i++){
    date = history[i].split(":")[0];
    date = Number(date) || 0;
    rate = history[i].split(":")[1];
    rate = Number(rate) || 0;
    if(assDate >= date){
    break; }
    rate;
    };
    fee = rate*hrs;
    fee

    If you use Globiflow you can keep the number/money field in Salary. Create a flow which is triggered by a change of the field and let  GF append the string  ";current date:new rate" in the text field (after existing entry). If you don't need the  number/money field enter each change in the text field, add a calc field "Current rate":

    var a =  @Rate history.split(":").pop(); 
    Number(a) || 0

    It shows you the actual rate in an own field.

    Rainer
    rg@delos-consulting.com 

    0
    Comment actions Permalink
  • Casper Hesseling

    Thanks Hamid and Rainer for your suggestions! Awesome!
    I will give it a try to see how it works.
    Thanks again!

    Casper

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk