ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: luckduck on June 03, 2020, 03:25:02 pm

Title: How to change the value of another column?
Post by: luckduck 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.
Title: Re: How to change the value of another column?
Post by: paramvir 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.