03-06-2024 12:37 PM - edited 03-06-2024 12:43 PM
Hello Experts,
Need some inputs in creating XPath expression to count row nodes. I know we can use count() function, however its not giving desired results.
Input is XML payload mentioned below or here.
Xpath I'm using is - count(/ss:Workbook/ss:Worksheet[@ss:Name='Credit Cards']/ss:Table/ss:Row)
Namespace declared - xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
When I tested the same XML and XPath expression on http://xpather.com/ it gave Expected results ( RowCount = 2)
However, in CPI the result is RowCount = 0
Can anyone please guide what is missing here ?
----------------------------------------------------------------------------
Input XML :
<?xml version="1.0" encoding="UTF-8"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>AB</Author>
<LastAuthor/>
<Created>2006-03-17T14:40:25Z</Created>
<LastSaved>2019-01-03T16:09:17Z</LastSaved>
<Company>END USER</Company>
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>8190</WindowHeight>
<WindowWidth>20430</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY>
<TabRatio>493</TabRatio>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Arial" x:Family="Swiss"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62">
<Borders/>
<Font ss:FontName="Verdana" x:Family="Swiss"/>
<Interior/>
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Verdana" x:Family="Swiss"/>
<Interior/>
<NumberFormat ss:Format="@"/>
</Style>
</Styles>
<Worksheet ss:Name="Credit Cards">
<Table ss:ExpandedColumnCount="24" ss:ExpandedRowCount="2" x:FullColumns="1" x:FullRows="1" ss:StyleID="s62" ss:DefaultRowHeight="12.5625">
<Column ss:StyleID="s62" ss:Width="51"/>
<Column ss:StyleID="s62" ss:Width="81.75"/>
<Column ss:StyleID="s62" ss:Width="61.5"/>
<Column ss:StyleID="s62" ss:Width="116.25"/>
<Column ss:StyleID="s62" ss:Width="92.25"/>
<Column ss:StyleID="s62" ss:Width="84"/>
<Column ss:StyleID="s62" ss:Width="36.75"/>
<Column ss:StyleID="s62" ss:Width="24.75"/>
<Column ss:StyleID="s62" ss:Width="118.5"/>
<Column ss:StyleID="s62" ss:Width="84"/>
<Column ss:StyleID="s62" ss:Width="44.25"/>
<Column ss:StyleID="s62" ss:Width="63.75"/>
<Column ss:StyleID="s62" ss:Width="67.5"/>
<Column ss:StyleID="s62" ss:Width="78.75" ss:Span="1"/>
<Column ss:Index="16" ss:StyleID="s62" ss:AutoFitWidth="0" ss:Width="66.75"/>
<Column ss:StyleID="s62" ss:Width="57.75"/>
<Column ss:StyleID="s62" ss:Width="68.25" ss:Span="1"/>
<Column ss:Index="20" ss:StyleID="s62" ss:Width="60"/>
<Column ss:StyleID="s62" ss:Width="65.25" ss:Span="1"/>
<Column ss:Index="23" ss:StyleID="s62" ss:Width="42"/>
<Row ss:AutoFitHeight="0" ss:StyleID="s63">
<Cell>
<Data ss:Type="String">Login ID</Data>
</Cell>
<Cell>
<Data ss:Type="String">Display Name</Data>
</Cell>
<Cell>
<Data ss:Type="String">Card Type</Data>
</Cell>
<Cell>
<Data ss:Type="String">Credit Card Number</Data>
</Cell>
<Cell>
<Data ss:Type="String">Expiration Date</Data>
</Cell>
<Cell>
<Data ss:Type="String">Name on Card</Data>
</Cell>
<Cell>
<Data ss:Type="String">Street</Data>
</Cell>
<Cell>
<Data ss:Type="String">City</Data>
</Cell>
<Cell>
<Data ss:Type="String">State/Province/Region</Data>
</Cell>
<Cell>
<Data ss:Type="String">Zip/Postal Code</Data>
</Cell>
<Cell>
<Data ss:Type="String">Country</Data>
</Cell>
<Cell>
<Data ss:Type="String">Air Default</Data>
</Cell>
<Cell>
<Data ss:Type="String">Car Default</Data>
</Cell>
<Cell>
<Data ss:Type="String">Hotel Default</Data>
</Cell>
<Cell>
<Data ss:Type="String">Rail Default</Data>
</Cell>
<Cell>
<Data ss:Type="String">Taxi Default</Data>
</Cell>
<Cell>
<Data ss:Type="String">Allow Air</Data>
</Cell>
<Cell>
<Data ss:Type="String">Allow Car</Data>
</Cell>
<Cell>
<Data ss:Type="String">Allow Hotel</Data>
</Cell>
<Cell>
<Data ss:Type="String">Allow Rail</Data>
</Cell>
<Cell>
<Data ss:Type="String">Allow Limo</Data>
</Cell>
<Cell>
<Data ss:Type="String">Gov Card Type</Data>
</Cell>
<Cell>
<Data ss:Type="String">Status</Data>
</Cell>
<Cell>
<Data ss:Type="String">Error</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:StyleID="s63">
<Cell>
<Data ss:Type="String">A000EmployeeID_0@google</Data>
</Cell>
<Cell>
<Data ss:Type="String">Corporate Amex</Data>
</Cell>
<Cell>
<Data ss:Type="String">AX</Data>
</Cell>
<Cell>
<Data ss:Type="String">CardmemberAcctNo0</Data>
</Cell>
<Cell>
<Data ss:Type="String">ExpireDate_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">FullName_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">Address_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">City_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">StateProvince_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">PostalCode_0</Data>
</Cell>
<Cell>
<Data ss:Type="String">US</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">0</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String">0</Data>
</Cell>
<Cell>
<Data ss:Type="String">0</Data>
</Cell>
<Cell>
<Data ss:Type="String">
0
</Data>
</Cell>
<Cell>
<Data ss:Type="String"/>
</Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<FreezePanes/>
<FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal>
<TopRowBottomPane>1</TopRowBottomPane>
<ActivePane>2</ActivePane>
<Panes>
<Pane>
<Number>3</Number>
</Pane>
<Pane>
<Number>2</Number>
<ActiveRow>0</ActiveRow>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
----------------------------------------------------------------------------
for some reason, not able to attach the file.
Thanks,
Akshay
Hello Akshay,
Can you use below expression in CPI and try once
count(/*:Workbook/*:Worksheet[@*:Name='Credit Cards']/*:Table/*:Row)
I hope it works 🙂
Regards,
Carol Pereira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.