Import a variable into a new databaseHello everyone,
In a database, I perform calculations on columns. At the end of the JSL script, At the end of these calculations, I have certain variables (as in the script below) and my goal is to enter these variables in a new database.
For example, the variable "a" would be entered in the 1st row and 1st column of my new data table, the variable "b" would be entered in the 2nd row and 1st column of my new data table...
Here is the database and script I'm using at the moment:

Names Default To Here (1);
dt = current data table();
a = Col Sum(:"test2"n);
show(a); // 3
wait(1);
NewTable = Open("...\NewTable");
NewTable[1,{"Column1"}] = [Expr(a)];The “NewTable” table is an empty table with only the column names already entered.
Maybe there is an easy JSL function to solve this problem, thanks for your help!
Data AccessRe: Importer une variable dans une nouvelle base de donnéesIf you don't have any rows in your NewTable, you have to add those. Also if you are adding single value to single cell, no need to use matrix as the value
Names Default To Here(1);
dt = New Table("", Add Rows(3), New Column("test2", Numeric, Continuous, Values([1, 1, 1])));
a = Col Sum(:"test2"n);
Show(a); // 3
NewTable = New Table("NewTable", Add Rows(0), New Column("Column1", Numeric, Continuous));
Wait(1); // demo purposes
NewTable << Add Rows(1);
Wait(1); // demo purposes
NewTable[1, {"Column1"}] = a;
Re: Import a variable into a new databaseOk great thank you, I was looking too complicated!
In fact, the “NewTable” table is a data table in which every week I will automatically enter new data.
For example today I enter the data for week 44 (Y2023-W44), so on for the next few weeks.
I'm trying to automate which column the data should appear in based on the week.
Example below with the base and the script:

a= Char( "Y" ) || Char(Year(today())) || "-" || Char( "W" ) || Char(Week Of Year( Today(),3)-1);
// a = "Y2023-W44"
NewTable[1, {"a"}] = char(c,10,2);
NewTable[2, {"a"}] = char(d,10,2);Here my variable “a” replaces today “Y2023-W44”, the next week the variable “a” will be “Y2023-W45” ect... To simply automate automatic cell filling per week.
c and d are variables calculated beforehand.
When writing the script like this it doesn't work correctly
Re: Importer une variable dans une nouvelle base de donnéesa is variable so you should use it as such.
Names Default To Here(1);
yyyy = Year(Today());
ww = Week Of Year(Today(), 3) - 1;
a = Eval Insert("Y^yyyy^-W^ww^");
dt_new = New Table("",
Add Rows(1),
New Column("Y2023-W44", Numeric, Continuous)
);
val = 2;
dt_new[1, a] = val;
Also I would consider making the date building a bit more clear by using something like this
Names Default To Here(1);
yyyy = Year(Today());
ww = Week Of Year(Today(), 3) - 1;
a = Eval Insert("Y^yyyy^-W^ww^");Re: Import a variable into a new databaseI used the following wording, it worked, I will take note of your answer and adjust the script!
Thank you for your reply !
a= Char( "Y" ) || Char(Year(today())) || "-" || Char( "W" ) || Char(Week Of Year( Today(),3)-1);
// a = "Y2023-W44"
NewTable[1, char(a)] = char(c,10,2);
NewTable[2, char(a)] = char(d,10,2);