Debatching Biztalk flat file message into individual grouped flat files based on value - biztalk

Have an issue where I am trying to debatch a flat file in BizTalk Server (comma delimited to tab-delimited) into individual flat files based on a value (in this example it would be PONumber) in the original file.
Sample input:
PartNumber,Weight,PONumber,Other
21519,234,46788,1
81919,456,47115,1
91910,789,47115,1
This would outcome into 2 messages such as:
PartNumber Weight PONumber Other
21519 234 46788 1
and
PartNumber Weight PONumber Other
81919 456 47115 1
91910 789 47115 1
I have seen similar things but no definite answers, or samples are dead links. Does anyone have a sample where they have done something like this or have a good solution?

Option 1: Convoy pattern
Change your schema so that it has a max occurs of 1 for the PO line, this will debatch each line into it's own messages when it is received.
Promote the PONumber so that it is a promoted property in the message context.
Have an Orchestration that has a correlation set based on the PO number, and initialises this on the first receive shape.
Have a receive shape with a following correlation that is in a wait shape inside a loop to receive all the other lines with the same PO number and combine them into a single message.
Option 2: Staging database
The other option is to just insert all of the rows into a SQL database, and then have a stored procedure that you poll that gets all the lines for a single PO.
This can sometimes be simpler, and avoids the issue of Zombies as you can implement this as a messaging only pattern or using a simpler Orcherstration without a loop.

Related

confluent-kafka-python library: read offset per topic per consumer_group

Due to pykafka EOL we are in the process of migration to confluent-kafka-python. For pykafka we wrote an elaborated script that produced output in the format:
topic
consumer group
offset
topic_alpha
total_messages
100
topic_alpha
consumer_a
10
topic_alpha
consumer_b
25
I am wondering whether there is a Python code that knows how to do something similar for the confluent-kafka-python?
small print: there is a partial example on how to read offsets per given consumer_group. However, I struggle to get the list of consumer_group per topic without manually parsing __consumer_offsets.
Use admin_client.list_groups() to get a list of groups, and admin_client.list_topics() to get all topics and partitions in the cluster and client.get_watermark_offsets() for the given topics.
Then for each consumer group instantiate a new consumer with the corresponding group.id, create a TopicPartition list to query committed offsets for and then call c.committed() to retrieve the committed offsets.
Subtract the committed offsets from the high watermark to get th

BizTalk Null Reference Error when Editing Party Agreement Envelope Properties

I am using BizTalk 2016 with Feature Update 3 (CU7), and the BizTalk Server Administration Console version 3.12.774.0
In the BizTalk Group I go to the Parties Node
Select a Party and go to it's Agreement in the Agreements list
Open the Agreement and go to the second tab (outgoing settings e.g. BizTalkApp->ThirdParty)
Go to Transaction Set Settings -> Envelopes
There is one envelope record. Go to this an change one of the values, e.g. GS4 - change from CCYYMMDD to YYMMDD
Click Apply
BizTalk displays the error Object reference not set to an instance of an object. (Microsoft.BizTalk.Administration.EdiText)
You cannot apply any changes to Envelope GS values because of this error. Changes to other agreement properties such as Interchange Settings -> Identifiers can be saved fine.
Has anyone come across this error before? How can we get past it?
It turns out that this error was caused by the fact I didn't have any value entered in the GS1 dropdown. Once I had entered this value in the row then other changes to the row could be saved.
Biztalk suspends instances of messages where the format or value of GS segments do not match those specified in the envelopes tab. So this means that I will have to analyse all the EDI documents we are receiving from our external party and make sure the GS1 values they use are covered. If there are more than one type of GS1 value used I will have to enter multiple rows in the Envelopes list.

BizTalk routing messages in message box based on field value

I have an exercise I'm working to complete; previously it was de-batching multiple XML messages from one file into individual files. Then I had to route individual files based on a field value which had been promoted using filters on a port. Now the exercise has evolved into taking a multi record XML file, breaking it down to individual XML records, and routing their output to different folders based on a value in one of the fields. The hurdles are as follow:
I can't promote a repeating field such as the one I have to use to sort the outbound messages
The value of the field is a system.int32; I am sorting on a "equal to or more than 900" and "less than 900" so I need the int type.
Beyond simple "idNUm >= 900" I am in over my head with the necessary expression(s).
I have the basic orchestration design down, I am just lacking the expressions. The node I am looking to validate against is IDNum, and occurs in each record.
UPDATE: Still not working
I put in the following in my expression: IDNumDefined.Customer.IDNum >= 900
and I get "identifier Customer does not exist in "IDNumDefined"; are you missing an assembly reference?" and "unexpected token '>=' "
Ideas? (sorry about not updating question here)
The debatching has to occur using an Envelope and Body schema.
Once you have this figured out, the debatching can occur using a simple XML disassembler. In the body schema you can quick promote your idNum field by associating a PropertySchema with it.
Once this is taken care of, it is easy to use 2 send ports in order to set your filter subscription(s).

How to add expression calculated field with query

I am using an Access 2010 DB and have a simple table with the following data:
I would like to add by query additional field named batch number. The batch number shall divided my series into batches. While if number of pipes is 0 then the batch number is 0, and if the number is between zeros the serie should get the same batch number. please see attached image.
when creating a new table on design mode after entering file name when choosing the type of the field in the data type column you choose calculates Don’t know if it’s the same on access
2010 but it’s work on 2013 et 2016

How to generate 837 DAT file with ICD10 code in Biztalk?

My 'BizTalk' application 'convert' txt file to 'DAT(EDI 837 005010X222A1)' file format.
'Now change is Need to generate DAT file with ICD10 code'
Question are
How I generate DAT with like 'HI*ABK'? right now in Combined837Doc.map, 'BK' is hardcoded
Should I change 'X12_00501_837_P.xsd'?
How BizTalk decide ABK | ABF | ABN | ABJ HI qualifier based on passed ICD code?
BK ---> Primary Diagnosis code -->ABK
BF ---> Secondary Diagnosis code -->ABF
BN ---> External Cause of injury -->ABN
BJ ---> Admitting Diagnosis -->ABJ
PR ---> Patient Reason for Visit -->APR
BR ---> Primary Procedure code -->BBR
BQ ---> Secondary Procedure code -->BBQ
BizTalk will not handle this in any sort of automatic way. The 837 XSDs will give you clues about what qualifiers are valid for a particular field, but they do not get set on those fields unless you set them in the map - either in the Value property of the destination node or via the output of a link (from a source node or functoid). You should not modify the XSD unless you need to support a non-standard qualifier that you and your trading partner have agreed to use - but you should stick to the standard qualifiers and encourage/require your partners to do so as well to avoid the need of such customization, and if you do make such modifications it should be to a trading partner version of the schema that gets properly mapped to a canonical format that does use the standard codes.
To further clarify, if you need to set the primary diagnosis code to BK and set other diagnostic codes to ABK, you have to provide that output from the map. You also have to ensure that you link to the proper HI node - only the first HI node for the Primary Diagnosis will accept BK as the qualifier (per WPC standards); subsequent ones can have ABK. I've written a couple blogs on this topic here and here.
What you really need here is to review the WPC specification for the Professional Claim v. 5010 and your trading partner's companion guide for the claim. These will provide all of this information so you can do your mapping correctly. You will also very likely need to work with an EDI claims specialist to get this right - HIPAA transactions are particularly challenging, and the claim forms are probably the most complicated of them.

Resources