Can you map a fixed value using the standard BizTalk mapper - biztalk

Normally, I create my BizTalk mappings in the XSL. Today I was playing around with the mapper but I am failing to do the most basic thing and googling it fails me (I find unrelated questions or the basic way to do it in XSL)
The question is simple though, I want to use the BizTalk mapper (btm file) to map one element to another and fill a second element with a fixed value.
Looking at the functoids, I have a date functoid which gets today's date but nothing to just type some text and map it.
Am I missing something very obvious?

The "built in" way to do this is to set the Value property on the destination node in the map (you can also use this property to desginate that an empty node should be created for this destination node). Unfortunately, this method offers no visual representation that the node is being set this way, except that it will prevent you from linking other nodes/functoids to that destination node. This may lead future devs (or your future self) to think the node isn't being set, or be confused as to why it's being set when it has no inputs.
To get around this, I've frequently used either a String Concatenate functoid (with the fixed value as the only parameter, manually typed in) or a Value Mapping functoid (set "true" as the first parameter and the fixed value as the second parameter). This offers a few benefits:
Visually shows that node is being set by the map
Allows you to set a meaningful label and/or comment on the functoid to denote why you're setting that value.

Related

What would be the best method of creating a block which outputs a Redstone Signal

I'm wondering what would be the best way to allow a block to send out a specific amount of Redstone output conditionally. While looking through other blocks that gave a Redstone output, I noticed that they were mostly using the getWeakPower() method. However, I noticed that this was a Deprecated method and my IDE formats the method with a strikethrough. Additionally, I also found another method named getStrongPower() (also Deprecated). Which one of these two method would be best to override or would there be a better way to set the Redstone output of a block.
Although these blocks have the #Deprecated annotation to them, the JavaDoc comment states that "Implementing/overriding is fine". These getWeakPower() and getStrongPower() methods are only flagged as being deprecated in the net.minecraft.block.Block class because they are not meant to be accessed from the Block class, instead they are supposed to be accessed from the net.minecraft.block.BlockState class as that will contain the most up to date state of a given block instance.
It seems that most blocks which use Redstone functionality override the getWeakPower() method to control the Redstone output of the block by returning a specific value from 0 to 15 from the method. It’s also possible to separately control the output of each side (only output on one side or different outputs on each side), by using the Direction parameter passed into the method to determine the returned value.
Note: You must override the canProvidePower() method to return true. Otherwise, neighboring blocks will not check the block for a Redstone output and the desired functionality won’t work.

what is the difference between System.Net.Cookie and System.Web.HttpCookie?

I obtain a HTTPCookie, but need a Net.Cookie. Are they just something you can recast, or how would i go about it?
Actually you have two questions:
Difference between System.Web.HttpCookie and System.Net.Cookie
How to convert from HTTPCookie to a Cookie.
Part 1)
This question is really interesting ,I'm still thinking why there are two classes which looks pretty same ,My initial thought was System.Web.HttpCookie inherits System.Net.Cookie but this isn't true both directly inherit from Object so they are distinct classes ,but the properties matches a lot ,so this gives a hope for the solution of part 2.
Part 2)
I think its possible to convert one into another theoretically since both are just objects if you populate them the right way it will work , here a little analysis when I compared the two classes.
Click to open in new tab to enlarge
Update:
The System.Web is made to be used in server-based apps and System.Net can be used for client based apps.
Some Thoughts:
Write a method or a static class which can convert one object into another, I haven't check all of them but properties whose names match, there signature also matches.
Properties which don't exists in the another object you can stuff some constant or a value which you know matches the scenario like Port number.
Good luck ,let me know how you came up with the final solution ,post the code or link.
Some Links
this post has some related code

Map optional element to required element

In my source schema I have an optional element, in my destination I have a required element.
If the source exists I have to map it directly to the destination, otherwise I need to generate a GUID and assign it to the destination. How do I do this?
If you're not using xslt for your mapping:
Test for existence using the "Logical Existence" functoid -> "Logical Not" functoid -> "Value Mapping" functoid. This checks to see if the node in the input does not exist, if it does not, then use the value mapping to set the value. You can put a hard coded value in the value mapper directly, or hook it to some other input. You may need to do a bit more work if your input node exists but is blank.
There are lots of examples on the internet.

Create an array in windows workflow foundation

Is it possible to create a new array in windows workflow? More specifically, in the designer.
I've created a variable of System.Int32[], but when I use it I get a NullReferenceException.
I've tried New Int32(5), and various permutations of Dim - nothing I have tried has worked.
I was able to create the array and pass it as an in/out parameter - this works, however the workflow will need to determine the actual size of the array.
To create and instantiate an array, you have to set a default value to your variable with New Int32(FOO SIZE){} or use an Assign activity to instantiate it with the correct size in runtime
You can also use List(Of T) or any other .NET collection structure to achieve dynamic size.
Note that the value must be the right part of a set expression. So, you can google how to do it in VB.NET and you will be fine.
I assume that if you are creating the array in the designer, as you stated, it is either a workflow variable or a workflow argument. The "WF" way to do this would be to use the "Default Value" column under the "Variables" and/or "Arguments" tab.
If it is an argument then the Default Value column only works if the Direction is "In". If your argument is a property, or an Out, or In/Out direction then you would have to use the method mentioned by Davi.
If you are creating it under the "Variables" tag then using the Default value column would be the more built-in approach. The syntax in the default column would be the same syntax mentioned by Davi: New Int32(FOO SIZE) {}

setting distinguished fields in a biztalk message

The issue:
I'm trying to transform and route a message based on its input file name. The file name gives hints about how the data should be processed. Being a noob I'm reasonably sure I'm doing this the hard way...
I created an orchestration. I transform the message from the input schema to the output schema. I'd like to examine the file name and add a little logic to classify the input message. That works just fine.
What I tried:
I added an expression shape after the transformation. I added logic to classify the message and assign that to a property. It won't allow me to change the property (messages are immutable?)
I added a construct message shape. I can set properties in a new message within this shape but it doesn't allow "if" statements or conditional assignments in the expression. I need conditional logic to search the file name string and set the property to one of several choices.
Any suggestions?
You can either wrap your logic into a .net helper method and call this from the assignment shape, or you can use the conditional flow control shapes provided by biztalk, such as the decide shape, and have multiple contruct shapes in your branches.
Let me know if you need more detail about either approach via a comment and I will expand the answer to include.
Hope this helps.
You could use a helper class to take the file name and return the value to set in the property.
Alternatively, you could use the decide shape for your if..then..else.
Have I understood your question?
HTH...

Resources