How to convert xml to EDI x12 855 message in logic app? - azure-logic-apps

How to convert xml to EDI x12 855 message in logic app?
i used Transform XML then i used Encode component there i get output as
enter image description here
when i try to add decode component in logic app flow it shows an error like,
Unable to process template language expressions in action 'Decode_X12_message' inputs at line '1' and column '1535': 'The template language function 'base64ToString' expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToString for usage details.'. and i used "#{base64ToString(item()?[body('Encode_to_X12_message_by_agreement_name')?['Payload']])}" in code view of decode component.
How can i solve this and how can i generate EDi x12 855 from XML input? please provide me the workflow components to be used and workflow definition language for specific component.
Here is my logic app workflow
enter image description here

Why are you using item(), you only need:
#{base64ToString(body('Encode_to_X12_message_by_agreement_name')
?['Payload'])}

Related

how to set up varest to call from json in url

Im quite new to using networking systems such as Varest for Json / Unreal.
I have been stuck on this for a few days now, and trying different varying outcomes but i keep coming back to this.
unreal blueprint photo
I am trying to select the "_links" in the URL and get unreal to process the account / Href key with my own.
I Read that there are diffrent types of Json - nested, High level and regular and understand these work like a Text format of Excel file.
I am wondering if this format is High level and how would I go about setting varest to read and process these strings?
https://horizon-testnet.stellar.org/ < -- URL has values
[2022.12.21-01.30.25:460][345]LogVaRest: Warning: UVaRestJsonObject::GetArrayField(277): No field with name _links of type Array

Logic app turn the binary to bad character

I created a logic app which gets the data from restapi. The content type of data is Application/protobuf(protobuf is a binary data made by google https://developers.google.com/protocol-buffers/docs/tutorials) I know that LA uses base64 encoding so it changes the data to base64 encoding. As the data to be deserialised via protoc complier so it needed binary format. So i store this data into a variable and trying to paas this further processing. But unfortunately the data stores in variable changes into boxes and ? So protoc compiler fails to deserialised the same.
I tried base64tobinary and http() as per suggestion mentioned section "other content type" on microsoft https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type#applicationxml-and-applica...
But it did not work. Can anybody help on this?
I tried reproducing the issue and found that the rest API body which we are receiving will be transformed back to string when we use string() i.e.. string(triggerBody()) dynamic expression.
Later, I convert to binary by using the dynamic expression 'binary', i.e. 'binary(outputs('Compose')', which will return a 'application/octet-stream' result. When I tried to convert back to a string, everything worked great for me.
Here is the flow of my logic app
and here is the output
I have changed the way of using. Instead of streaming, I am storing the data into file and processing further.

display math formulas typed in Latex or asciiMath

I want to convert a user input written in Latex or AsciiMath to math formulausing using MathJax with react. I have trouble implementing it especially that the input will be up to the user. Does anyone has an idea on how to begin?
Check out better-react-mathjax. It is a highly configurable package for using MathJax in React and the documentation contains examples of both static and dynamic content in Latex, AsciiMath and MathML.
Sandbox with dynamic example in Latex: https://codesandbox.io/s/better-react-mathjax-example-latex-3vsr5
Sandbox with dynamic example in AsciiMath: https://codesandbox.io/s/better-react-mathjax-example-asciimath-p0uf1
Just store the user input in a state variable and perform any validation and post-processing on it (to make sure that it is valid Latex or AsciiMath) and then use it in an expression like shown in one of the examples in the sandboxes.
PS. I wrote this package DS

How to parse and play Blob/Binary data from database in Angular 5

In my Angular 5 application, I am retrieving data which is stored as VARBINARY(MAX) in SQL Server database. It looks like this in the database field: 0xFEA47E451A40AE4571E51F...
When I retrieve it from database using a GET call via .NET WebAPI, it is shown like this in console from my Angular app: aFwwbUYFjhvbv=bhBGVJHvchjhcbsHKfvHbbh...
I know the MIME type of this data (it is either MP3 or WAV). How can I parse/read this data in Angular 5 client and play it using an HTML <audio> component?
I have looked at several related solutions but none seem to be applicable due to one error or another, or perhaps there is a lack of understanding on my part.
My assumptions are that Blob data has the audio content which I can play. I have to convert it to a File first. This is what I am trying:
const file = new File([blobData], "audio.mp3")
this.audioSource = URL.createObjectURL(file)
And in the HTML, I assign audioSource as the source of an HTML5 component.
<audio [src]="audioSource" type="audio/mp3"></audio>
This results in a net::ERR_UNKNOWN_URL_SCHEME error.
I tried sanitizer.bypassSecurityTrustUrl(this.audioSource) as well but this doesn't work either. What am I doing wrong, and how can I get the intended effect?
please check this answer : https://stackoverflow.com/a/40329529/1160236
if you have blob data with correct binaries all you have to do is to create URL using URL.createObjectURL(blob) then pass it to the audio tag as a source. (check step-3)
if you don't have blob data with correct binaries you can create blob data as shown in step-2.
I have created an Angular example which uses DomSanitizer via a custom pipe.
<audio [src]="audioSource | safe:'url'" id="audio" controls #audioTag></audio>
Reference : https://stackoverflow.com/a/40329529/1160236
Angular implementation using reference : https://stackblitz.com/edit/angular-audio-blob
DomSanitizer example: https://medium.com/#swarnakishore/angular-safe-pipe-implementation-to-bypass-domsanitizer-stripping-out-content-c1bf0f1cc36b
I hope this will help. just remember all you need is valid blob data.

Can i get the filename like #[header:originalFilename] in a component in mule3

I use
<gzip-compress-transformer/>
<base64-encoder-transformer/>
after a file connector, and then write a component to deal with the gzip+base64 content.
How can i get the file name in the component?
Note that we introduced annotations in Mule 3 for doing runtime injection, this means you can specify how to invoke a component without needing transformers i.e.
public void save(#Payload String fileContents, #InboundHeaders("originalFilename") String originalFilename)
See: http://www.mulesoft.org/documentation/display/MULE3USER/Creating+Service+Objects+and+Transformers+Using+Annotations
Does your component implement Callable? If not, do you want to keep your component Mule-unaware?
Based on your answers to these questions, different options exist:
With Callable, you get the headers in message.getProperty...
Without implementing Callable, you can access RequestContext to get the current Mule event and from there reach the message properties. But this makes your component Mule aware.
Otherwise, have your component's method take a second parameter (String originalFilename) and use a standard expression transformer to transform the payload in an array that contains: #payload, #[header:originalFilename]. This arrays will then be passed as arguments to your component's method.
[message.outboundproperties[originalFilename]]
with this expression you can get the original file name in the component.

Resources