Use variable in a map?

Home Page Forums BizTalk 2004 – BizTalk 2010 Use variable in a map?

Viewing 1 reply thread
  • Author
    Posts
    • #25805

      Hi there.

      I have a map with more than one page. Now I need a value which I get after using some funtoids in page 1 and I need it in page 2 and 3. Is there a way to build a variable to get access to this value from page 2 and 3?

      Thanks in advanced.

      Wolfgang

    • #25808

      this could be a solution :

      you can realize all you mapping with the BizTalk Mapper, then you right-clic on the map and choose validate to access the generated xsl and extension object.

      Then you can modify you xsl to use the result of you some functoid for the other.

      I’m not sure you can realize what you want with the Mapper and there may be some tips but i’m not sure it will be keep if you decide to change one thing in the map (because the mapper generatevariable name)

      • #25811

        A simple method would be to use C# scripting functoids:

        One page one have a C# scripting functoid with this code:

        string globalVariable = null;
        public string SetVariable(string param)
        {
            globalVariable = param;
            return param;
        }

        Then on page 2  add a C# scripting functoid
        public string GetVariablePage2()
        {
            return globalVariable;
        }

        And on page 3

        public string GetVariablePage3()
        {
            return globalVariable;
        }

        • #25825

          Hi.

          Thanks for your helps and tips. Nice to know there are some more ways to go! 😉

          First I tried the way with the “globalVariable” – but I didn’t get the value of the variable to another page. I did it like greg wrote and used it in another scripting functoid on page 2. The compiler didn’t brought an error because of the “new” variable in the code, so I know the variable was recognized in the code. I will do some further checks, why the variable will loose the value if I use it an page 2…

          But thanks again for your help so far.

          Wolfgang  

          • #25842

            Please correct me if I’m wrong, but as I understand it BizTalk maps execute by building the destination from the top down.  I would suggest linking the script functoid that sets the global variable on page 1 to the root node of the destination schema to ensure that it executes prior to any other node.

            • #25844

              Hi.

              Yes, a good idea. I will have a look at it.

              Thanks a lot.

              Wolfgang

        • #26561

          Hey i found this 5 years later and it still works, thank you 🙂

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.