Author Topic: How to change the value of another column?  (Read 1566 times)

luckduck

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
How to change the value of another column?
« on: June 03, 2020, 03:25:02 pm »
Hi Paramvir,

I want to use a formula to change the values ​​in colB column based on the values ​​in colA column in three ways: normal editing, Excel import and copy &paste.

As you can see in the code below, setting two or more column values in one formula seems to work. Do you still have problems if you keep using it like this?

Code: [Select]
var formulas = [
    ["tax", function( rd ){
        rd.profit = rd.revenues - rd.income;   //Is there any problem using this?
        return rd.amt* 0.25;
    }]
];

Is it possible to enable/disable a formula conditionally as below code?
For example, I want it to be active only when editing, not when importing data.

Code: [Select]
var formulas = [
    ["tax", function( rd ){
        if(condition) {
            rd.profit = rd.revenues - rd.income;
            return rd.amt* 0.25;
        } else {
            return rd.tax;
        }
    }]
];

Thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to change the value of another column?
« Reply #1 on: June 03, 2020, 11:03:47 pm »
1. Yes that can be used.

2. Its usage like that is not tested so far but I don't foresee any issue in using it.