07-10-2021 11:40 AM
Hello,
I would like to know if it was possible, with the ODBC module, to write the content of a global variable to a specific cell in an Excel file ?
I have 200 cells to fill and i want to put the X,Y cell coordonates in variables.
Thanks a lot
Good day
Hugus
07-10-2021 12:41 PM
ODBC and DASYLab treat Excel like a relational database table. That means that references to the table are based on record (row) and field (cell).
DASYLab uses the first row of the sheet as the labels for the fields. To identify a specific cell to write to, you would need to identify it by record (row) and field (cell in that row).
Each row would need a unique identifier for addressing. You must dedicate one column (field) to that, as we cannot access the Excel Row number.
The help says this:
Replace when — Specifies that DASYLab overwrites specified data in an existing table.
Search condition — Specifies the search condition for the data to be replaced. If several data sets meet the search condition, DASYLab overwrites all these data sets.
You can enter expressions Field name+Comparator+Constant connected by AND or OR. You can use a global variable and a global string as a constant. You must enclose string-constants in inverted commas even if it is a global string.
Examples: | Id = ${VAR_56} |
Value1 > 5.0 AND Text1 = `${STR_2}` |
That suggests that you could use a search condition that looks like the first example, Id = ${VAR_56} to find the row.
Then, in the Field Assignments, remove all the fields that you don't want to update, and update the specific field in that row with the contents of a global variable.
If it's a fixed row/column, then you only need to specify the name of the unique identfier, "Id" in the above example.
Search: "Id = 3"
Field: "Col5" assigned to ${VAR_35}
Would put the contents of variable 35 into row 3 column 5.
I haven't tested this, but, Excel knows its own row number. The identifier might be a formula, =ROW(A2), which enters the number 2 into the cell at A2. Remember that row 1 is the field name/column label.
I did look at DDE... variables are only allowed in the "Item" definition.