DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

ODBC - Writing variable value to specific cell

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

0 Kudos
Message 1 of 2
(1,927 Views)

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. 

--cj --DASYLab Pro -- Retired --- I am no longer employed by NI or Measurement Computing. My opinions are just that, seasoned by 25+ years of working with DASYLab. Please contact www.MeasX.com or www.mccdaq.com for active support options.
0 Kudos
Message 2 of 2
(1,902 Views)