Biztalk - ExecutesendpipeLine() - biztalk

Input file:
<ns0:Emp xmlns:ns0="http://Test_Excepn.input">
<ns1:EmpRecord xmlns:ns1="http://Test_Excepn.SingleSchema">
<ID>1</ID>
<Name>N1</Name>
</ns1:EmpRecord>
<ns1:EmpRecord xmlns:ns1="http://Test_Excepn.SingleSchema">
<ID>2</ID>
<Name>N2</Name>
</ns1:EmpRecord>
<ns1:EmpRecord xmlns:ns1="http://Test_Excepn.SingleSchema">
<ID>3</ID>
<Name>N3</Name>
</ns1:EmpRecord>
</ns0:Emp>
Expected Result:
Apply business logic and filter out some record from Input file
Orchestration logic
Created envelop schema
Single schema
Loop the input file schema based on record count
Apply business logic
Add the single emp record in send pipeline
Exit the loop
EXECUTESENDPIPELINE
Craeted Sendpipeline with xmlassembler (Document schema as Singlemsg and envelopschema as Input_Envelop)
Created variable sendinputmessages type.
var_PipelineInputMessage_EMP.Add(Singlemsg);
Outside the loop
Input_Envelop = null;
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteSendPipeline(typeof(SendPipeline_EMP), var_PipelineInputMessage_EMP, Input_Envelop);
But the when i am dumping Input_envelop no record is found in envelop schema.

Related

How to see .w trigger is working for my query?

Just for the knowledge I just want to see how WRITE triggers execute for the query below. Is it possible to see them?.
FOR EACH Customer EXCLUSIVE-LOCK WHERE NAME = "Go Fishing Ltd":
ASSIGN Customer.Balance = 600.
END.
Add:
-clientlog path/to/log.log -logginglevel 4 -logentrytypes 4GLTrace
to your startup command.
This will create a log of all of the calls that your code makes.
For more information: https://knowledgebase.progress.com/articles/Knowledge/P9893
You can also use the LOG-MANAGER system handle within your code to dynamically control the logging at runtime:
https://docs.progress.com/bundle/openedge-abl-troubleshoot-applications/page/LOG-MANAGER-system-handle-attributes-and-methods.html
but for simple purposes like this it is easier to just add the startup parameters.
Watch the log-manager show the write trigger being executed on the sports2020 database:
def var clog as char no-undo.
def var lclog as longchar no-undo.
assign
clog = guid + '.log'.
log-manager:logfile-name = clog
log-manager:log-entry-types = '4gltrace:5,4glmessages'
.
for each Customer exclusive-lock where name = 'Go Fishing Ltd':
Customer.Balance = Customer.Balance + 1. // write trigger only fires when record changes
end.
log-manager:close-log().
copy-lob from file clog to lclog.
message string( lclog ).
https://abldojo.services.progress.com/?shareId=62978a833fb02369b25479f0
Relevant snippet from the output:
4GLTRACE Return from Main Block "Customer Customer" [sports2020trgs/wrcust.p]

How to map a 4 loops schema to a 3 loops schema in Biztalk

Now I have a source schema which having 3 loops, "OrderHeader", "OrderLine" and "OrderSchedule", like the following picture.
Source schema
Now I want to map it to the standard X12 EDI 855 schema
And the following picture is mapping
The following is my input file
<OrderHeader>
<code_BAK02>1</code_BAK02>
<po_no_BAK03>2</po_no_BAK03>
<po_date_BAK04>20200630</po_date_BAK04>
<OrderLine>
<assigned_id_PO101>1</assigned_id_PO101>
<qty_PO102>1</qty_PO102>
<OrderSchedule>
<sch_qty_ACK02>1</sch_qty_ACK02>
</OrderSchedule>
</OrderLine>
</OrderHeader>
<OrderHeader>
<code_BAK02>2</code_BAK02>
<po_no_BAK03>3</po_no_BAK03>
<po_date_BAK04>20200830</po_date_BAK04>
<OrderLine>
<assigned_id_PO101>1</assigned_id_PO101>
<qty_PO102>100</qty_PO102>
<OrderSchedule>
<sch_qty_ACK02>100</sch_qty_ACK02>
</OrderSchedule>
</OrderLine>
</OrderHeader>
After executing test mapping, the result is like following, which is not what I expect.
<ns0:X12_00403_855>
<ns0:BAK>
<BAK02>112220000204853</BAK02>
<BAK03>20201116</BAK03>
<BAK04>20210730</BAK04>
</ns0:BAK>
<ns0:BAK>
<BAK02>112220000206821</BAK02>
<BAK03>20201119</BAK03>
<BAK04>20210630</BAK04>
</ns0:BAK>
<ns0:PO1Loop1>
<ns0:PO1>
<PO101>1</PO101>
<PO102>1</PO102>
</ns0:PO1>
<ns0:PO1>
<PO101>1</PO101>
<PO102>100</PO102>
</ns0:PO1>
<ns0:ACKLoop1>
<ns0:ACK>
<ACK02>1</ACK02>
</ns0:ACK>
<ns0:ACK>
<ACK02>100</ACK02>
</ns0:ACK>
</ns0:ACKLoop1>
</ns0:PO1Loop1>
</ns0:X12_00403_855>
What I expect is like following,
<ns0:X12_00403_855>
<ns0:BAK>
<BAK02>112220000204853</BAK02>
<BAK03>20201116</BAK03>
<BAK04>20210730</BAK04>
<ns0:PO1Loop1>
<ns0:PO1>
<PO101>1</PO101>
<PO102>1</PO102>
</ns0:PO1>
<ns0:ACKLoop1>
<ns0:ACK>
<ACK02>1</ACK02>
</ns0:ACK>
</ns0:ACKLoop1>
</ns0:PO1Loop1>
</ns0:BAK>
<ns0:BAK>
<BAK02>112220000206821</BAK02>
<BAK03>20201119</BAK03>
<BAK04>20210630</BAK04>
<ns0:PO1Loop1>
<ns0:PO1>
<PO101>1</PO101>
<PO102>100</PO102>
</ns0:PO1>
<ns0:ACKLoop1>
<ns0:ACK>
<ACK02>100</ACK02>
</ns0:ACK>
</ns0:ACKLoop1>
</ns0:PO1Loop1>
</ns0:BAK>
</ns0:X12_00403_855>
The result I want is to following the structure of the input file, is there any method to achieve that?

How to add a value to the existing element value and return it as a new value

This is the xml file.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<AtcoCode> System-Start-Date= 2018-05-16T12:35:48.6929328-04:00, " ", System-End-Date = 9999-12-31, " ", 150042010003</AtcoCode>
<NaptanCode>esxatgjd</NaptanCode>
<PlateCode>
</PlateCode>
<CleardownCode>
</CleardownCode>
<CommonName>Upper Park</CommonName>
<CommonNameLang>
</CommonNameLang>
<ShortCommonName>
</ShortCommonName>
<ShortCommonNameLang>
</ShortCommonNameLang>
<Landmark>Upper Park</Landmark>
<LandmarkLang>
</LandmarkLang>
<Street>High Road</Street>
<StreetLang>
</StreetLang>
<Crossing>
</Crossing>
<CrossingLang>
</CrossingLang>
<Indicator>adj</Indicator>
<IndicatorLang>
</IndicatorLang>
<Bearing>NE</Bearing>
<NptgLocalityCode>E0046286</NptgLocalityCode>
<LocalityName>Loughton</LocalityName>
<ParentLocalityName>
</ParentLocalityName>
<GrandParentLocalityName>
</GrandParentLocalityName>
<Town>Loughton</Town>
<TownLang>
</TownLang>
<Suburb>
</Suburb>
<SuburbLang>
</SuburbLang>
<LocalityCentre>1</LocalityCentre>
<GridType>U</GridType>
<Easting>541906</Easting>
<Northing>195737</Northing>
<Co-ordinates>51.64255,0.04944</Co-ordinates>
<StopType>BCT</StopType>
<BusStopType>MKD</BusStopType>
<TimingStatus>OTH</TimingStatus>
<DefaultWaitTime>
</DefaultWaitTime>
<Notes>
</Notes>
<NotesLang>
</NotesLang>
<AdministrativeAreaCode>080</AdministrativeAreaCode>
<CreationDateTime>2006-11-06T00:00:00</CreationDateTime>
<ModificationDateTime>2010-01-16T07:58:02</ModificationDateTime>
<RevisionNumber>5</RevisionNumber>
<Modification>rev</Modification>
<Status>act</Status>
</root>
How to achieve this?
Question: Create the path range index for the status element and fetch all the documents that has status del
after fetching all the documents, you need to create the new element called currentreservationnumber under RevisionNumber element.
The value of the currentrevisionnumber will be +1 to the RevisionNumber.
I think the warning about sequential numbers is related to system-wide unique numbers/ids (like Oracle sequence), so not a worry in this case?
If you only ever have one RevisionNumber, and you can find it without a path index, you can maybe get by with element-value query on the RevisionNumber since it's already indexed.
Given that you get the document somehow, it could be as simple as:
let $doc := fn:doc ('/foo.xml')
let $rev-node := $doc/root/RevisionNumber
return xdmp:node-insert-after ($rev-node, <currentreservationnumber>{$rev-node + 1}</currentreservationnumber>)
though remember to consider locking if you are doing a big query/update. And you might need to switch to node-replace if there is already a currentreservationnumber.

How do I retrieve embedded XML values using MSXML in AutoItV3?

I am trying to use AutoItV3 to automate the insertion of some Entities into a piece of software.
It will be far easier if my automation can read information from an xml file and use this to generate my entities, as I can then parse in different xml files for different tests.
I am using a popular extension MSXML to try and do this. This can be found here:
https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=44418
My XML is a relatively simply structure where I will have various fields under each 'Entity' within all of my 'Entities'
<?xml version="1.0" encoding="UTF-8"?>
<entities>
<entity>
<name>
Mation Jr, Mr Auto
</name>
<legalname>
Mr Auto Mation Jr
</legalname>
</entity>
<entity>
<name>
Mation Sr, Mr Auto
</name>
<legalname>
Mr Auto Mation Sr
</legalname>
</entity>
</entities>
In my script header I am importing the MSXML au3 file and setting the XML path
#include <_MSXML.au3>
; Set the XML file
$xmlpath = #ScriptDir & "\Entity.xml"
My Question is, how can I iterate through the attributes of each Entity within all Entities?
This is what I have so far, but i am not understanding how I would retrieve values from an individual entity listed under the Entities node:
; Fetch All Entities from XAML
$ENTITIES = _MSXML_SelectNodes($oXml, "entities/entity")
If ($ENTITIES[0] > 0) Then
; This part works and will iterate for x amount of entities provided
; Fetch Entity as pos $i
For $i = 1 To $ENTITIES[0] Step 1
; How can I iterate through attributes from ENTITIES[$i] ??
Next
Else
MsgBox(4096, 'Error', 'No entity was provided')
EndIf
I understand my question is quite broad but I think there should be enough information to start with
This issue with that UDF is that it seems to want to return strings for everything instead of xml objects which are more useful. I would avoid it and instead just just use the com object yourself with $oXml = ObjCreate("Msxml2.DOMDocument") and then have a look at the documentation here.
But anyways, I think this code will get you what you want:
; Set the XML file
$xmlpath = #ScriptDir & "\Entity.xml"
$oXml = ObjCreate("Msxml2.DOMDocument")
$oXml.load($xmlpath)
; Fetch All Entities from XAML
$objNodeList = $oXml.selectNodes("entities/entity")
For $node in $objNodeList
ConsoleWrite($node.nodename & #CRLF)
$objChildNodeList = $node.selectNodes("*")
For $ChildNode in $objChildNodeList
ConsoleWrite(#TAB & $ChildNode.nodename & ' = ' & $ChildNode.text & #CRLF)
Next
Next
Notice how there is really no need to use a UDF and you can just use the com object's built in methods. In my opinion, this is simpler than using the UDF.
Another thing in general that is worth mentioning is that if you ever have trouble figuring out how to do anything in autoit you can try searching for how to do that same thing in vba or vbs since the languages are pretty similar and autoit can use all the com objects that are used in vba/vbs. When vba/vbs does something like this Set oXml = CreateObject("Msxml2.DOMDocument") just do this in autoit: $oXml = ObjCreate("Msxml2.DOMDocument").

XmlReader how to read or skip a specific child that does not always exist

I have a big XML file that I must read with XmlReader because it can not be loaded into memory. This XML is formatted in this way (is a reduced version):
<?xml version="1.0" encoding="windows-1252"?>
<Products>
<Product>
<Code>A14</Code>
<Name>Name1</Name>
<Manufacturer>
<Name>ManufacturerName</Name>
</Manufacturer>
<ProdCategories>
<ProdCategory>
<Code>015</Code>
<Name>ProdCategoryName</Name>
</ProdCategory>
</ProdCategories>
<Barcodes> <!-- note this line -->
</Barcodes>
</Product>
<Product>
<Code>A15</Code>
<Name>Name2</Name>
<Manufacturer>
<Name>ManufacturerName</Name>
</Manufacturer>
<ProdCategories>
<ProdCategory>
<Code>016</Code>
<Name>ProdCategoryName</Name>
</ProdCategory>
</ProdCategories>
<Barcodes>
<Barcode>
<Code>1234567890</Code> <!-- note this line -->
</Brcode>
</Barcodes>
</Product>
Note the <Barcode> <Code> elements: in the first <product> is missing.
This is the code that I use for read it and for put these data in a database:
XmlReader reader = XmlReader.Create("Products.xml");
reader.MoveToContent();
do
{
reader.ReadToFollowing("Code");
code = reader.ReadElementContentAsString();
reader.ReadToFollowing("Name");
Name = reader.ReadElementContentAsString();
reader.ReadToFollowing("Name");
ManufacturerName = reader.ReadElementContentAsString();
reader.ReadToFollowing("Code");
ProdCategoryCode = reader.ReadElementContentAsString();
reader.ReadToFollowing("Code");
BarcodeCode = reader.ReadElementContentAsString();
//Here I use "code", "Name", "ManufacturerName" variables to insert into a database
} while (reader.Read());
reader.Close();
All XML tags are present in all products except the <Barcodes> childs (<Barcode><Code>) that is present only on some product, then I cannot jump at next "code" with last ReadToFollowing because if not present I capture the first <product><code>.
I cant control XML output and cant modify it (is third-party).
There's a way to "ReadToFollowing('<Barcodes><Barcode><Code>')" so that I can specific what should seek and if there is not found I can jump it?
Thank you for your help, excuse my bad english.
I would suggest to pull each Product element into a tree model, using either https://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.readfrom(v=vs.110).aspx or https://msdn.microsoft.com/en-us/library/system.xml.xmldocument.readnode(v=vs.110).aspx, then you can use LINQ to XML query methods or XPath to read out the data of each Product in a safe way while maintaining a low memory footprint.

Resources