01-30-2017 08:26 AM
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,
02-01-2017 11:02 AM
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
02-02-2017 03:39 AM - edited 02-02-2017 03:39 AM
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 ;-).
10-05-2017 07:40 AM
Problem has been resolved in last shipped version.