- GS-Base 19 adds JScript and VBscript scripting, significantly extending the previous GS-Base functionality. With a simple few lines script, you can
now perform mass importing / merging / joining / updating tables with up to 256 million records from text, Excel and all other files in entire folders. You can merge and filter millions of records in seconds.
You can also switch to the ‘shared’ mode, where other programs can update the same text, Excel or other file at the same time.
- You can create/edit/save/use global scripts saved as a part of the GS-Base settings and scripts saved directly in database files:
- The “File > Application Scripts” dialog box:
https://citadel5.com/help/gsbase/scripts.png
Writing scripts is easy. For example, this merely two-line script imports the 1st table from an Excel workbook and saves the GS-Base database as a new file:
GSBase.ImportExcelTable(“e:\excel_data\file_a.xlsx”, “”, 1, “”);
GSBase.SaveDatabaseAs(“e:\new_file.gsb”);
Mass merging records from CSV or Excel files from the entire folder (to the current table) is equally simple. You just enter the following and click “run” or assign a keyboard shortcut to run it:
var mergeParams = GSBase.CreateMergeParams();
// merge records from e.g file2000.xlsx, file2001.xlsx, …, file2023.txt
mergeParams.path = “e:\data\file20??.xlsx”;
mergeParams.table = “products”;
mergeParams.matchFieldNames = false;
GSBase.MergeRecordsFromExcelFile(mergeParams, 1)
Saving filtered (by e.g. a “year”) and sorted results as 23 Excel files with field names in the 1st row:
var field = GSBase.CreateFieldParams();
GSBase.GetField(1, field);
field.sortIndex = 1;
field.sortIndex = “A”
for (i = 0; i < 23; ++i)
{
field.filter = 2000 + i;
GSBase.SetField(1, field)
GSBase.SaveRecordSetAsExcel(“e:\sample_” + field.filter + “.xlsx”, 0, 1, 0);
}
For many other examples, tips and the complete list of functions,
please see:
- The list of all scripting functions and sample JScript scripts:
https://citadel5.com/help/gsbase/com_samples.htm