Possible DB.TOXML bug? (UniVerse 11.3.1 on AIX) - aix

Based on my understanding of the XMAP specification relative to DB.TOXML, the following XMAP represents a simple object model containing two child tables with the same parent table.
The command DB.TOXML CUST_ACT.XML XMAP_CustomerActivity.XML produces an XML file containing the records and fields from the parent table and one of the child tables as expected. However, the fields for each record of the other child table are repeated once within the record node. If I switch the child TableMaps, in the parent TABLECLASSMAP, the problem switches to the other child table.
It appears that when more than one (child) TableMap is specified in the parent map, fields from the table in the child map referenced by the first (child) TableMap entry are repeated TableMap times in record nodes of that table. This behavior was noticed during development of a process in a real-world UniVerse database environment with a more involved object model.
In order to confirm, I created simple CUSTOMER / CONTACT, CUSTOMER / ORDER files with a few test records for demonstration purposes. If this is a bug versus an XMAP configuration error on my part, then it appears either the XMAPCreate() API function or the XMAPAppendRec() API function may not correctly support this structure.
XMAP:
?xml version="1.0" encoding="UTF-8"?>
<!-- DOCTYPE U2XMAP SYSTEM "U2XMAP.DTD" -->
<U2XMAP version="1.0" Name="XMAP1" >
<!-- Table/Class map XCLASS_CLASS -->
<TABLECLASSMAP MapName="M1" StartNode="/Customers/Customer" TableName="CUSTOMERTBL">
<ColumnMap Node="CustKey" Column="CKEY"/>
<ColumnMap Node="Name" Column="CNAME" />
<TableMap Node="Orders/Order" MapName="M2" />
<TableMap Node="Contact/Methods" MapName="M3" />
</TABLECLASSMAP>
<TABLECLASSMAP MapName="M2" StartNode="Orders/Order" TableName="ORDERTBL">
<ColumnMap Node="CustKey" Column="C.KEY" />
<ColumnMap Node="OrderKey" Column="#ID" />
<ColumnMap Node="OrderDate" Column="ORDERDATE" />
<ColumnMap Node="ProductId" Column="PRODUCTID" />
</TABLECLASSMAP>
<TABLECLASSMAP MapName="M3" StartNode="Contact/Methods" TableName="CONTACTMETHTBL">
<ColumnMap Node="CustKey" Column="C.KEY" />
<ColumnMap Node="ContactKey" Column="#ID" />
<ColumnMap Node="Type" Column="TYPE" />
<ColumnMap Node="Address" Column="ADDRESS" />
</TABLECLASSMAP>
<RelatedTable>
<MapParentKey TableName="CUSTOMERTBL" Column="CKEY" KeyGenerate="No" />
<MapChildKey TableName="ORDERTBL" Column="CKEY" />
</RelatedTable>
<RelatedTable>
<MapParentKey TableName="CUSTOMERTBL" Column="CKEY" KeyGenerate="No" />
<MapChildKey TableName="CONTACTMETHTBL" Column="CKEY" />
</RelatedTable>
</U2XMAP>
RESULT:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<Customers>
<Customer>
<CustKey>1</CustKey>
<Name>MOUSE, MICKEY</Name>
<Orders>
<Order>
<CustKey>1</CustKey>
<OrderKey>10</OrderKey>
<OrderDate>01-04-2022</OrderDate>
<ProductId>555R3232</ProductId>
<CustKey>1</CustKey>
<OrderKey>10</OrderKey>
<OrderDate>01-04-2022</OrderDate>
<ProductId>555R3232</ProductId>
</Order>
<Order>
<CustKey>1</CustKey>
<OrderKey>1</OrderKey>
<OrderDate>12-27-2021</OrderDate>
<ProductId>5323423</ProductId>
<CustKey>1</CustKey>
<OrderKey>1</OrderKey>
<OrderDate>12-27-2021</OrderDate>
<ProductId>5323423</ProductId>
</Order>
<Order>
<CustKey>1</CustKey>
<OrderKey>2</OrderKey>
<OrderDate>12-28-2021</OrderDate>
<ProductId>9299399</ProductId>
<CustKey>1</CustKey>
<OrderKey>2</OrderKey>
<OrderDate>12-28-2021</OrderDate>
<ProductId>9299399</ProductId>
</Order>
<Order>
<CustKey>1</CustKey>
<OrderKey>3</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>23492349</ProductId>
<CustKey>1</CustKey>
<OrderKey>3</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>23492349</ProductId>
</Order>
</Orders>
<Contact>
<Methods>
<CustKey>1</CustKey>
<ContactKey>1</ContactKey>
<Type>HOMEPH</Type>
<Address>444-555-6666</Address>
</Methods>
<Methods>
<CustKey>1</CustKey>
<ContactKey>2</ContactKey>
<Type>HOMEST</Type>
<Address>580 LIBERTY CIR</Address>
</Methods>
</Contact>
</Customer>
<Customer>
<CustKey>2</CustKey>
<Name>FROG, KERMIT</Name>
<Orders>
<Order>
<CustKey>2</CustKey>
<OrderKey>4</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>99338822</ProductId>
<CustKey>2</CustKey>
<OrderKey>4</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>99338822</ProductId>
</Order>
<Order>
<CustKey>2</CustKey>
<OrderKey>5</OrderKey>
<OrderDate>12-28-2021</OrderDate>
<ProductId>23874771</ProductId>
<CustKey>2</CustKey>
<OrderKey>5</OrderKey>
<OrderDate>12-28-2021</OrderDate>
<ProductId>23874771</ProductId>
</Order>
</Orders>
<Contact>
<Methods>
<CustKey>2</CustKey>
<ContactKey>3</ContactKey>
<Type>HOMEPH</Type>
<Address>777-888-9999</Address>
</Methods>
<Methods>
<CustKey>2</CustKey>
<ContactKey>4</ContactKey>
<Type>WORKPH</Type>
<Address>909-090-0909</Address>
</Methods>
</Contact>
</Customer>
<Customer>
<CustKey>3</CustKey>
<Name>BIRD, BIG</Name>
<Orders>
<Order>
<CustKey>3</CustKey>
<OrderKey>6</OrderKey>
<OrderDate>12-30-2021</OrderDate>
<ProductId>83776632</ProductId>
<CustKey>3</CustKey>
<OrderKey>6</OrderKey>
<OrderDate>12-30-2021</OrderDate>
<ProductId>83776632</ProductId>
</Order>
<Order>
<CustKey>3</CustKey>
<OrderKey>7</OrderKey>
<OrderDate>12-30-2021</OrderDate>
<ProductId>R29898W9</ProductId>
<CustKey>3</CustKey>
<OrderKey>7</OrderKey>
<OrderDate>12-30-2021</OrderDate>
<ProductId>R29898W9</ProductId>
</Order>
<Order>
<CustKey>3</CustKey>
<OrderKey>8</OrderKey>
<OrderDate>12-31-2021</OrderDate>
<ProductId>23884888</ProductId>
<CustKey>3</CustKey>
<OrderKey>8</OrderKey>
<OrderDate>12-31-2021</OrderDate>
<ProductId>23884888</ProductId>
</Order>
<Order>
<CustKey>3</CustKey>
<OrderKey>9</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>29993999</ProductId>
<CustKey>3</CustKey>
<OrderKey>9</OrderKey>
<OrderDate>12-29-2021</OrderDate>
<ProductId>29993999</ProductId>
</Order>
</Orders>
<Contact>
<Methods>
<CustKey>3</CustKey>
<ContactKey>5</ContactKey>
<Type>HOMEPH</Type>
<Address>405-040-5040</Address>
</Methods>
</Contact>
</Customer>
</Customers>
Any ideas? Thanks in advance. UniVerse 11.3.1 on AIX.
I also posted this question here but haven't gotten much exposure. (where you can better see highlighted in red the repeated entries).

Looks like it might be a bug to me. I tested it under Linux with 11.3.2 and I noticed the same behavior. It may be a system limitation, but if that were the case I would expect a failure on the mapping call as it seems to be pretty particular.
I would open a ticket with Rocket. I used the HS.SALES demo data that comes with UniVerse to replicate. I will provide it here for you to use in your report. It will be much easier for support to either confirm the bug or tell you what we are collectively doing wrong if they are already working with the same data.
<?xml version="1.0" encoding="UTF-8"?>
<!-- DOCTYPE U2XMAP SYSTEM "U2XMAP.DTD" -->
<U2XMAP version="1.0" Name="XMAP1" >
<!-- Table/Class map XCLASS_CLASS -->
<TABLECLASSMAP MapName="M1" StartNode="/Customers/Customer" TableName="CUSTOMER">
<ColumnMap Node="CustID" Column="#ID"/>
<ColumnMap Node="FirstName" Column="FNAME"/>
<ColumnMap Node="LastName" Column="LNAME" />
<ColumnMap Node="State" Column="STATE" />
<ColumnMap Node="ProductID" Column="PRODID" />
<TableMap Node="States/State" MapName="M2" />
<TableMap Node="Products/Product" MapName="M3" />
</TABLECLASSMAP>
<TABLECLASSMAP MapName="M2" StartNode="States/State" TableName="STATES">
<ColumnMap Node="StateName" Column="NAME" />
</TABLECLASSMAP>
<TABLECLASSMAP MapName="M3" StartNode="Products/Product" TableName="PRODUCTS">
<ColumnMap Node="Price" Column="LIST" />
<ColumnMap Node="Description" Column="DESCRIPTION" />
</TABLECLASSMAP>
<RelatedTable>
<MapParentKey TableName="CUSTOMER" Column="PRODID" KeyGenerate="No" />
<MapChildKey TableName="PRODUCTS" Column="PRODID" />
</RelatedTable>
<RelatedTable>
<MapParentKey TableName="CUSTOMER" Column="STATE" KeyGenerate="No" />
<MapChildKey TableName="STATES" Column="CODE" />
</RelatedTable>
</U2XMAP>
In the mean time if you are blocked and the mapping isn't overly complex you can probably just add I-Descriptors and TRANS (or XLATE) over to the other file to include it in parent dictionary and thus not require any additional table mapping.
Good Luck,

Related

Prestashop API error: Property Category->link_rewrite is not valid

I'm try to modify a category through Prestashop API, but I got error:
Validation error: "Property Category->link_rewrite is not valid"
I'm using Postman to Put my changes, but even if I just copy and past the result of the GET in the body of the PUT call, the result give me this error.
this is what I send in the body of the PUT call:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<category>
<id>
<![CDATA[3]]>
</id>
<id_parent xlink:href="http://localhost/prestashop/api/categories/2">
<![CDATA[2]]>
</id_parent>
<active>
<![CDATA[1]]>
</active>
<id_shop_default>
<![CDATA[1]]>
</id_shop_default>
<is_root_category>
<![CDATA[0]]>
</is_root_category>
<position>
<![CDATA[0]]>
</position>
<date_add>
<![CDATA[2021-11-18 16:10:04]]>
</date_add>
<date_upd>
<![CDATA[2021-11-18 16:10:04]]>
</date_upd>
<name>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[Clothes]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[Clothes]]>
</language>
</name>
<link_rewrite>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[clothes]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[clothes]]>
</language>
</link_rewrite>
<description>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[<p>Discover our favorites fashionable discoveries, a selection of cool items to integrate in your wardrobe. Compose a unique style with personality which matches your own.</p>]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[<p>Discover our favorites fashionable discoveries, a selection of cool items to integrate in your wardrobe. Compose a unique style with personality which matches your own.</p>]]>
</language>
</description>
<meta_title>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[]]>
</language>
</meta_title>
<meta_description>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[]]>
</language>
</meta_description>
<meta_keywords>
<language id="1" xlink:href="http://localhost/prestashop/api/languages/1">
<![CDATA[]]>
</language>
<language id="2" xlink:href="http://localhost/prestashop/api/languages/2">
<![CDATA[]]>
</language>
</meta_keywords>
<associations>
<categories nodeType="category" api="categories">
<category xlink:href="http://localhost/prestashop/api/categories/4">
<id>
<![CDATA[4]]>
</id>
</category>
<category xlink:href="http://localhost/prestashop/api/categories/5">
<id>
<![CDATA[5]]>
</id>
</category>
</categories>
<products nodeType="product" api="products">
<product xlink:href="http://localhost/prestashop/api/products/1">
<id>
<![CDATA[1]]>
</id>
</product>
<product xlink:href="http://localhost/prestashop/api/products/2">
<id>
<![CDATA[2]]>
</id>
</product>
</products>
</associations>
</category>
</prestashop>
Please attach exactly what you are sending in, as this is too little information to answer your question in a meaningful way.
It is possible that what you are submitting is really invalid.
In PrestaShop, the link_rewrite fields must be of type URL.
If you use PHP to generate the value, you can use the Tools::str2url() PrestaShop method.

Attachment entity without body tag

Issue : I am using email attachment entity to receive email with attachments.
Our environment is - D365. When Email is sent using outlook or d365 as well, the attachment entity is without body tag
Steps to reproduce
Create attachment locally (can be any extension or encoding)
Send email either to account synced with D365 or use D365 to send email to same along with attachment.
query email with attachments and also get body tag
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="email" >
<attribute name="modifiedon" />
<attribute name="sender" />
<order attribute="modifiedon" descending="false" />
<filter>
<condition attribute="modifiedon" operator="on-or-after" value="2020-03-25" />
</filter>
<link-entity name="activitymimeattachment" from="objectid" to="activityid" link-type="inner" alias="ak" >
<attribute name="filename" />
<attribute name="body" />
</link-entity>
</entity>
</fetch>
o Expected output.
<resultset morerecords="0">
<result>
<modifiedon date="3/27/2020" time="3:08 PM">2020-03-27T15:08:54+05:30</modifiedon>
<sender> xyz#abc.com</sender>
<ak.filename>test-20181009T133141.xml</ak.filename>
<ak.body>VGhlIFVSTCBzaG91bGQgYmUgY29udmVydGVkIHRvIEJhc2U2NA==</ak.body>
</result>
</resultset>
•
o Received output.
<resultset morerecords="0">
<result>
<modifiedon date="3/27/2020" time="4:04 PM">2020-03-27T16:04:24+05:30</modifiedon>
<sender>xyz#abc.com</sender>
<ak.filename>test-2019-04-17T200954.660.xml</ak.filename>
</result>
<result>
<modifiedon date="3/27/2020" time="4:12 PM">2020-03-27T16:12:15+05:30</modifiedon>
<sender> xyz#abc.com</sender>
<ak.filename>image002.jpg</ak.filename>
</result>
<result>
<modifiedon date="3/27/2020" time="4:12 PM">2020-03-27T16:12:15+05:30</modifiedon>
<sender> xyz#abc.com</sender>
<ak.filename>image004.jpg</ak.filename>
</result>
<result>
<modifiedon date="3/27/2020" time="4:12 PM">2020-03-27T16:12:15+05:30</modifiedon>
<sender> xyz#abc.com</sender>
<ak.filename>image006.jpg</ak.filename>
</result>
</resultset>
Please help us in finding the root cause of this issue.
You have to remove distinct="true" form your fetchxml and then it shall work.
Try below fetchxml
<fetch version="1.0" output-format="xml-platform" mapping="logical" >
<entity name="email" >
<attribute name="modifiedon" />
<attribute name="sender" />
<order attribute="modifiedon" descending="false" />
<filter>
<condition attribute="modifiedon" operator="on-or-after" value="2020-03-25" />
</filter>
<link-entity name="activitymimeattachment" from="objectid" to="activityid" link-type="inner" alias="ak" >
<attribute name="filename" />
<attribute name="body" />
</link-entity>
</entity>
</fetch>

Create a XML file from a trigger

Here is the situation, I need to create a XML file every time a specific field from the table gets updated to "C" or "L". The Xml file needs to be like this:
<?xml version="1.0" standalone="yes"?>
<DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="ID_COMAND" fieldtype="string" WIDTH="20" />
<FIELD attrname="EVENT" fieldtype="string" WIDTH="1" />
</FIELDS>
<PARAMS />
</METADATA>
<ROWDATA>
<ROW RowState="4" ID_COMAND="3721" EVENT="C" />
</ROWDATA>
</DATAPACKET>
It's been very hard to find a way to do this, help me please.

CRM 2011 Custom SQL based report error after change default filters

I have some report in SQL (with pre-filtering).
I import this report to CRM (Dynamics CRM 2011) and run - everything is ok.
But when I changed default filter for this report in CRM and save - report is not run anymore (report error).
I download and checked this two files (before change default filters and after change that) and problem is that when I changed filters, crm insert into link-entity (xml 'join' node) some alias which is GUID. When I change this alias (in rdl file) from GUID to 'ab' for example and reimport this report to CRM, it is work again - until someone change default filter...
So what I shold to do ? Because now it is impossible to give users possibility to change default filter for report in CRM.
edit:
Mostly whole xml for .rdl file is the same for both reports. Only difference is in CustomProperty node. In this node is definition for defualt filter.
Section from work report width default filters without any changes:
<CustomProperty>
<Name>Custom</Name>
<Value>
<MSCRM xmlns="mscrm">
<ReportFilter>
<ReportEntity paramname="P1">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="sc_accountevents">
<all-attributes />
<filter type="and">
<condition attribute="modifiedon" operator="last-x-days" value="30" />
</filter>
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P2">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="businessunit">
<all-attributes />
<filter type="and">
<condition attribute="modifiedon" operator="last-x-days" value="30" />
</filter>
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P3">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="account">
<all-attributes />
<filter type="and">
<condition attribute="modifiedon" operator="last-x-days" value="30" />
</filter>
</entity>
</fetch>
</ReportEntity>
</ReportFilter>
</MSCRM>
</Value>
</CustomProperty>
Section from broken report (after change default filters):
<CustomProperty>
<Name>Custom</Name>
<Value>
<MSCRM xmlns="mscrm">
<ReportFilter>
<ReportEntity paramname="P1" displayname="Account Events">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="sc_accountevents">
<all-attributes />
<link-entity name="account" from="accountid" to="sc_klientid" visible="false" link-type="outer" alias="a_58cc568ca7ece311896000155d68d9dc">
<attribute name="sc_jednostkabiznesowaid"/>
</link-entity>
<link-entity name="systemuser" from="systemuserid" to="owninguser" alias="ae">
<filter type="and">
<condition attribute="businessunitid" operator="eq-businessid"/>
</filter>
</link-entity>
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P2" displayname="Jednostki biznesowe">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="businessunit">
<all-attributes />
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P3" displayname="Klienci">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="account">
<all-attributes />
</entity>
</fetch>
</ReportEntity>
</ReportFilter>
</MSCRM>
</Value>
</CustomProperty>
And again work report with changed default filters but with edit alias in link-entity node:
<CustomProperty>
<Name>Custom</Name>
<Value>
<MSCRM xmlns="mscrm">
<ReportFilter>
<ReportEntity paramname="P1" displayname="Account Events">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="sc_accountevents">
<all-attributes />
<link-entity name="account" from="accountid" to="sc_klientid" visible="false" link-type="outer" alias="ab">
<attribute name="sc_jednostkabiznesowaid"/>
</link-entity>
<link-entity name="systemuser" from="systemuserid" to="owninguser" alias="ae">
<filter type="and">
<condition attribute="businessunitid" operator="eq-businessid"/>
</filter>
</link-entity>
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P2" displayname="Jednostki biznesowe">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="businessunit">
<all-attributes />
</entity>
</fetch>
</ReportEntity>
<ReportEntity paramname="P3" displayname="Klienci">
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="account">
<all-attributes />
</entity>
</fetch>
</ReportEntity>
</ReportFilter>
</MSCRM>
</Value>
</CustomProperty>
Ok.
Probably no way to do something with this.
It's a bug which is remove in rollup 17 (2 months ago)...

How to write "anything goes" in Relax NG?

Is there a way to write that there are completely no restrictions on content of an element in Relax NG?
In XML Schema something like this is apparently possible with
<xs:sequence>
<xs:any namespace="##targetNamespace" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
Can I do an equivalent of this in Relax NG?
I propose this solution, dividing attributes and elements declaration, and using mixed element to allow mixed content.
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<ref name="anyElement"/>
</start>
<define name="anyElement">
<element>
<anyName/>
<ref name="anyAttributes"/>
<mixed>
<zeroOrMore>
<ref name="anyElement"/>
</zeroOrMore>
</mixed>
</element>
</define>
<define name="anyAttributes">
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</define>
</grammar>
Okay, I don't know if this the best way, but I have adapted this from "any" definition in Relax NG spec.
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<ref name="Anything"/>
</start>
<define name="Anything">
<zeroOrMore>
<choice>
<element>
<anyName/>
<ref name="Anything"/>
</element>
<attribute>
<anyName/>
</attribute>
<text/>
</choice>
</zeroOrMore>
</define>
</grammar>