Export pivot table to Excel gives error: missing tag row (with an unwanted tag INSERT) - export-to-excel

I am building a WPF application which uses OWC pivot table to display some data. When I click the built-in button to export the pivot table to excel, it writes to the log file with such error message:
XML ERROR in PivotTable
REASON: Missing Tag
ACTION: Aborting current XML group
FILE: C:\Users\MY_NAME\AppData\Local\Temp\PivotTable71147_cachedata.xml
GROUP: PivotCache
TAG: row
When I open PivotTable71147_cachedata.xml file, it looks like this:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='RecID' rs:number='1' rs:write='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='0' rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<rs:insert>
<z:row RecID='1'/>
<z:row RecID='2'/>
</rs:insert>
</rs:data>
</xml>
I am not an expert on pivot table format, but here in this example there are indeed two rows to be inserted, which have all the row data (RecID is the only column element). And I compared with some online .xml example, as well as the schema for rs:data schema, it seems that this element is not supposed to be there, i.e., should directly have multiple elements as children elements. But why do I have this rs:insert ?
UPDATED:
In this example I am using OWC11. Should I try OWC10 instead (or is it because some version mismatch)? Because in one of our MS Access application we are using OWC10 and the Export to Excel function works fine. But I have some problem using OWC10 in .NET.

Related

XPATH Pull First and Last name from multiple root element

Getting a pull from a Saas API that sends unformatted XML. Need to pull the first and last names out of each element to send to another application.
I haev tried numerous things in Power Automate but they all error out due to the XML not having a parent node.
<Request ID="19131795" Status="Approved">
<TimeOffDate>2023-02-14</TimeOffDate>
<TimeOffDayOfWeek>Tuesday</TimeOffDayOfWeek>
<TimeStart></TimeStart>
<TimeEnd></TimeEnd>
<TimeOffHours>8.000</TimeOffHours>
<TimeOffTypeName>Maternity Leave</TimeOffTypeName>
<EmployeeID>646028926148N</EmployeeID>
<LoginID>Marie</LoginID>
<Firstname>Marie-Eve</Firstname>
<Lastname>B</Lastname>
<UserCategory>Software Development</UserCategory>
<SubmittedDate>2022-03-11</SubmittedDate>
<Deducted>Yes</Deducted>
<Comment>time-off request created by administrator</Comment>
</Request>
<Request ID="21301056" Status="Approved">
<TimeOffDate>2023-02-14</TimeOffDate>
<TimeOffDayOfWeek>Tuesday</TimeOffDayOfWeek>
<TimeStart>2023-02-14T13:00:00</TimeStart>
<TimeEnd>2023-02-14T17:00:00</TimeEnd>
<TimeOffHours>4.000</TimeOffHours>
<TimeOffTypeName>Paid Time Off - Salary</TimeOffTypeName>
<EmployeeID>FRM992097</EmployeeID>
<LoginID>Robert</LoginID>
<Firstname>Bobby</Firstname>
<Lastname>D</Lastname>
<UserCategory>Information Technology</UserCategory>
<SubmittedDate>2023-01-06</SubmittedDate>
<Deducted>Yes</Deducted>
<Comment></Comment>
</Request>
<Request ID="21324804" Status="Approved">
<TimeOffDate>2023-02-14</TimeOffDate>
<TimeOffDayOfWeek>Tuesday</TimeOffDayOfWeek>
<TimeStart></TimeStart>
<TimeEnd></TimeEnd>
<TimeOffHours>8.000</TimeOffHours>
<TimeOffTypeName>NL Parental Leave 1</TimeOffTypeName>
<EmployeeID></EmployeeID>
<LoginID>Kamila</LoginID>
<Firstname>Kamila</Firstname>
<Lastname>K</Lastname>
<UserCategory>NL Customer Service</UserCategory>
<SubmittedDate>2023-01-09</SubmittedDate>
<Deducted>Yes</Deducted>
<Comment>time-off request created by administrator</Comment>
</Request>
I have tried the following xpath filters.
'/Firstname|/Lastname')
'Firstname|Lastname')

get "wevtutil epl test.evtx /q:" to utilize multiple selects to save one event log file

Im trying to basically do the same thing event viewer can do by creating a custom view and then save it as a evtx file. Here is what I have so far as well as the custom XML generated by creating a custom view in event viewer. Utilizing powershell as well.
$queryXML =
Path="Application"
Path="Application">*[System[Provider[#Name='Application'] and (Level=1 or Level=2 or Level=3)]]
Path="Security">*[System[Provider[#Name='Application'] and (Level=1 or Level=2 or Level=3)]]
Path="Setup">*[System[Provider[#Name='Application'] and (Level=1 or Level=2 or Level=3)]]
Path="System">*[System[Provider[#Name='Application'] and (Level=1 or Level=2 or Level=3)]]
Path="ForwardedEvents">*[System[Provider[#Name='Application'] and (Level=1 or Level=2 or Level=3)]]
wevtutil epl C:\Users\user\Desktop\test.evtx "/q: $queryXML"
-
<QueryList>
<Query Id="0" Path="Application">
<Select Path="Application">*[System[(Level=1 or Level=2)]]</Select>
<Select Path="Security">*[System[(Level=1 or Level=2)]]</Select>
<Select Path="Setup">*[System[(Level=1 or Level=2)]]</Select>
<Select Path="System">*[System[(Level=1 or Level=2)]]</Select>
<Select Path="ForwardedEvents">*[System[(Level=1 or Level=2)]]</Select>
</Query>
</QueryList>
figured out a method. Save the query xml as a .txt file then instead of designating a event log name like "system" use the path to the .txt file with the query.
To expand further on the accepted solution, you save your XML structured query as a file (say "SQ.xml") and then alter your wevtutil statement like so:
wevtutil epl SQ.xml temp.evtx /sq:true
This tells wevtutil to use the XML query saved in SQ.xml and export the logs to a file called temp.evtx. You must specify /sq:true to tell it to query a structured query file.
The structured query format is mostly XPath but Windows puts some slight tweaks on it. More info can be found here. For example:
<QueryList>
<Query Id="0">
<Select Path="System">*[System[TimeCreated[#SystemTime >= '2022-04-22T05:00:00' and #SystemTime <= '2022-04-22T15:00:00']]]</Select>
<Select Path="Application">*[System[TimeCreated[#SystemTime >= '2022-04-22T05:00:00' and #SystemTime <= '2022-04-22T15:00:00']]]</Select>
</Query>
</QueryList>
The above query grabs Systems and Application log files for today (April 22 between 5AM and 3PM UTC. Note that because this is XML, the greater than and less than signs must be encoded.

XPath for stackoverflow dump files

Am working with file with following format:
<badges>
<row Id="1" UserId="1" Name="Teacher" Date="2009-09-30T15:17:50.66"/>
<row Id="2" UserId="3" Name="Teacher" Date="2009-09-30T15:17:50.69"/>
</badges>
I am using pig xmlloader to fetch this xml data into hdfs.
A = LOAD '/badges' using org.apache.pig.piggybank.storage.XMLLoader('row') as (x:chararray);
B = foreach A generate xpath(x, '/row#Id').
Dump B;
Output I get () - No values.
I want the file output as text i.e 1,1,Teacher,2009-09-30T15:17:50.66. How can I do this?
I'm not familiar with pig xmlloader, but /row#Id has two problems:
It's not valid XPath
If it were, it would be an absolute path
Try:
B = foreach A generate xpath(x, 'row/#Id').
It uses valid syntax and a relative path.
Use XPathAll for extracting attributes.Xpath has an issue when it comes to attributes.
REGISTER '/path/piggybank-0.15.0.jar'; -- Use the jar name you downloaded
DEFINE XPathAll org.apache.pig.piggybank.evaluation.xml.XPathAll();
B = foreach A generate XPathAll(x, 'row/#Id', true, false).$0 as (id:chararray);

SparkR: "Cannot resolve column name..." when adding a new column to Spark data frame

I am trying to add some computed columns to a SparkR data frame, as follows:
Orders <- withColumn(Orders, "Ready.minus.In.mins",
(unix_timestamp(Orders$ReadyTime) - unix_timestamp(Orders$InTime)) / 60)
Orders <- withColumn(Orders, "Out.minus.In.mins",
(unix_timestamp(Orders$OutTime) - unix_timestamp(Orders$InTime)) / 60)
The first command executes ok, and head(Orders) reveals the new column. The second command throws the error:
15/12/29 05:10:02 ERROR RBackendHandler: col on 359 failed
Error in select(x, x$"*", alias(col, colName)) :
error in evaluating the argument 'col' in selecting a method for function
'select': Error in invokeJava(isStatic = FALSE, objId$id, methodName, ...) :
org.apache.spark.sql.AnalysisException: Cannot resolve column name
"Ready.minus.In.mins" among (ASAP, AddressLine, BasketCount, CustomerEmail, CustomerID, CustomerName, CustomerPhone, DPOSCustomerID, DPOSOrderID, ImportedFromOldDb, InTime, IsOnlineOrder, LineItemTotal, NetTenderedAmount, OrderDate, OrderID, OutTime, Postcode, ReadyTime, SnapshotID, StoreID, Suburb, TakenBy, TenderType, TenderedAmount, TransactionStatus, TransactionType, hasLineItems, Ready.minus.In.mins);
at org.apache.spark.sql.DataFrame$$anonfun$resolve$1.apply(DataFrame.scala:159)
at org.apache.spark.sql.DataFrame$$anonfun$resolve$1.apply(DataFrame.scala:159)
at scala.Option.getOrElse(Option.scala:120)
at org.apache.spark.sql.DataFrame.resolve(DataFrame.scala:158)
at org.apache.spark.sql.DataFrame$$anonfun$col$1.apply(DataFrame.scala:650)
at org.apa
Do I need to do something to the data frame after adding the new column before it will accept another one?
From the link, just use backsticks, when accessing the column, e.g.:
From using
df['Fields.fields1']
or something, use:
df['`Fields.fields1`']
Found it here: spark-issues mailing list archives
SparkR isn't entirely happy with "." in a column name.

How to place dynamic barcodes on multipage document using XSLFO

I have a requirement where the pdf is a multiple page document.I want to place barcode on the page and the value of the barcode should set from a data source. How can i identify the page number and accordingly set the barcode value for that page?
It depends on the engine. If you are using the Ecrion XSL-FO Engine then you can use the following placeholders:
Simple barcodes:
$pageNumber
$pageIdx
<fo:block text-align="center">
<xf:barcode type="3of9"
include-checksum="false" value="This
is page $pageNumber" extended="true" fo:font="8.5pt Helvetica"
fo:color="navy"/>
</fo:block>
Javascript barcodes:
page-sequence properties: $pageNumber, $pageIdx, $sheetIdx
document properties: $documentPageIdx, $documentSheetIdx, $documentPageCount, $documentIdx
merge context(DAL) properties: $mergedPageIdx, $mergedSheetIdx, $mergedPageCount
<xf:barcode type="3of9"
include-checksum="false"
value="javascript:function run(){return 'Javascript: Page $pageNumber';}run();"
extended="true" fo:font="8.5pt Helvetica" fo:color="navy"
fo:content-width="7.051in" fo:scaling="uniform"/>

Resources