ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: pbassey on October 28, 2022, 12:30:14 am

Title: Creating Dynamic Columns while using the importXl method
Post by: pbassey on October 28, 2022, 12:30:14 am
Does your grid control support the loading of data from and excel file (using the importXL method) as well as calculated columns in-between the columns/rows loaded as a result of the importXL data load?

I want to load all the data from an .xlsx file, but also insert new columns inside the loaded grid that has formulas such as "MID(N3,6,19)”.

Is this possible ??
Title: Re: Creating Dynamic Columns while using the importXl method
Post by: paramvir on October 28, 2022, 07:07:48 am
Yes

New columns can be added or inserted with grid.Columns() API

Excel functions can be added with grid.Range().value() API

Code: [Select]
        grid.Columns().add([{dataIndx:'type', title:'Type', width: 150}]);

        var values = (new Array(5).fill(0)).map(function(val, indx){
        return '=MID(A' + (indx+2) + ',16)';
        });
       
        grid.Range('B2:B6').value(values);

jsfiddle: https://jsfiddle.net/rwbteua1/

API reference:

https://paramquery.com/pro/api#method-Columns

https://paramquery.com/pro/api#method-Range