NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TS 2016 Excel property loader : getting rid of a cell formula and only get value

Hi,

 

I try to retreive values from an Excel file using the TS 2016 new property loader and, if the value cell is a reference to another cell, TS returns the refrence cell id plus the value without separator("A1value" and not "value"). I'd like to only have the value.

 

Exemple :

 

Cell A1 contains the following string : "value 1"

Later in the Excel file I have the TS property loader syntax to get the value of cell A1 in the Locals variable "variable1" :

-------------------------------------------------------------------------------------------------------------------------

| <PropertyGroup name='MainSequence'> |                     |                 |

-------------------------------------------------------------------------------------------------------------------------

| <Sequence>                                                  |<Category> | <PropertyLookup> | <Value> |

-------------------------------------------------------------------------------------------------------------------------

| MainSequence                                              | {Locals}      | variable1                  | =A1         |

-------------------------------------------------------------------------------------------------------------------------

 

I wrote the Cell "=A1" as the formula used to get value of cell A1, Excel in fact displays "value 1" but editing the cell displays "=A1".

I expect TS property loader to put the value "value 1" in the Locals variable variable1, but I have the following value : "A1value1", without any separator between the cell reference and the value.

 

Is there any way to get get rid of the cell reference and only have the value ?

 

Thanks,

 

 

 

 

 

0 Kudos
Message 1 of 4
(2,613 Views)

Thanks for reporting this issue. I was able to reproduce the issue and created a bug report under ID 627950. Unfortunately I do not see any simple workaround.

TestStand ships code for Excel property loader. You can modify the code and build a new dll  to fix the issue. Do the following to fix the issue by updating the code:
1. Open <TestStand>\Components\PropertyLoader\NI_Excel\NI_Excel.csproj in Visual Studio (I used Visual Studio 2015)
2. Edit ExcelReader.cs file
3. Search for the function "GetCellValue"
4. In the function replace
string cellValue = cell.InnerText;
with
string cellValue = cell.CellValue?.InnerText ?? cell.InnerText;
5. Build the project
6. Make sure the new dll is in <TestStand>\Components\PropertyLoader directory
7. Restart TestStand

Note: If you deploy your sequence file, make sure you deploy newly created dll.

 

-Shashidhar

0 Kudos
Message 2 of 4
(2,560 Views)

Thank you for your answer.

 

As a bug has been submited (thank you for that), I suppose it will be shipped in further TS 2016 upgrade. I will wait as I unfortunatly do not have a Visual Studio dev environment.

 

I actually bypass this problem by prefixing each value by a separator (@ actually) and splitting it in TS to get rid of the separator and what preceed it. Ugly workaround, but functionnal ;-).

 

0 Kudos
Message 3 of 4
(2,546 Views)

Problem has been resolved in last shipped version.

0 Kudos
Message 4 of 4
(2,116 Views)