BizTalk Server Orchestration - Biztalk Expression Editor String Operations

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > April 2005 > Biztalk Expression Editor String Operations





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Biztalk Expression Editor String Operations
njhudson

2005-04-26, 8:46 pm

I am trying to use a message assignment shape to create the output
filename for my message. I want the filename to be a prefix plus the
input filename. The input file filename is
"InFile(FILE.ReceivedFileName)". I declare the variable "Prefix" and
then I use a Concat statement to splice them together. Intellisense
doesn't indicate an error. However, only the ReceivedFileName piece
shows up in the file name. What am I doing wrong? My code is
below:

Thanks,
Nathan
_________________________
SetFileName = InFile;
Prefix = "ABC";
SetFileName(FILE.ReceivedFileName) = System.String.Concat(Prefix,
InFile(File.ReceivedFileName));
__________
If the input filename is "SomeFileName.txt", I should get
"ABCSomeFileName.txt". But I only get "SomeFileName.txt".

Stephen W. Thomas

2005-04-27, 7:55 am

Hello.

Xlang puts restrictions on what you can do with a string. When I have
needed complex logic, I have either called an outside .net component or used
a variable of type StringBuilder.

In your case, can you just add the string to the beginning of the other
string like this: SetFileName(FILE.ReceivedFileName) = Prefix +
InFile(File.ReceivedFileName));
You might have to set the context values to string variables first to get
this to work.

Hope this helps.

Stephen W. Thomas
http://www.geekswithblogs.net/sthomas


"njhudson" wrote:

> I am trying to use a message assignment shape to create the output
> filename for my message. I want the filename to be a prefix plus the
> input filename. The input file filename is
> "InFile(FILE.ReceivedFileName)". I declare the variable "Prefix" and
> then I use a Concat statement to splice them together. Intellisense
> doesn't indicate an error. However, only the ReceivedFileName piece
> shows up in the file name. What am I doing wrong? My code is
> below:
>
> Thanks,
> Nathan
> _________________________
> SetFileName = InFile;
> Prefix = "ABC";
> SetFileName(FILE.ReceivedFileName) = System.String.Concat(Prefix,
> InFile(File.ReceivedFileName));
> __________
> If the input filename is "SomeFileName.txt", I should get
> "ABCSomeFileName.txt". But I only get "SomeFileName.txt".
>
>

njhudson

2005-04-27, 8:50 pm

Ok. I have built an assembly. Note that I know very little about
object oriented programming and nothing about C# until a few weeks
ago. It compiled successfully and I deployed it to the GAC. I then
added the reference to it in the Solution Explorer. But now when I
type the expression I get a "identifier expected" error in the
expression editor.

I want to get a file named "salestracing_042705.txt".

Here is my expression and the source code for the assembly:

Expression:
------------------------------
SetFileName = Claflin850;
FileType = "SalesTracing";
SetFileName(FILE.ReceivedFileName) =
NameOutputFile.NameOutputFile.(FileType);
-----------------------------

Assembly source:
----------------------------
using System;
using Microsoft.XLANGs.BaseTypes;

namespace NameOutputFile
{
/// <summary>
/// This class takes a string and adds "MMDDYY.txt".
/// </summary>
[Serializable]
public class NameOutputFile
{
// public NameOutputFile()
// {
// }
public string NameTheFile(string FileType)
{
string OutputFileName;
DateTime dt=DateTime.Now;
string Date;

Date = dt.ToString("MMddyy");

OutputFileName = System.String.Concat(FileType, "_", Date,
".txt");

return OutputFileName;
}
}
}

Stephen W. Thomas

2005-04-28, 2:47 am

Hello.

From what I can see you .net code looks great! I do not think you need this
reference though: ‘using Microsoft.XLANGs.BaseTypes;”

In the expression editor, your last line should be:
SetFileName(FILE.ReceivedFileName) = NameOutputFile.NameOutputFile(FileType);
I think you have an extra “.”. You probably have a red “!” on the shape?

If you continue to have problems, please send me Orch and .net code to me at
swthomas@NOSPAMbiztalkgurus.com (just remove NOSPAM part).

Hope this helps.

Stephen W. Thomas
http://www.geekswithblogs.net/sthomas


"njhudson" wrote:

> Ok. I have built an assembly. Note that I know very little about
> object oriented programming and nothing about C# until a few weeks
> ago. It compiled successfully and I deployed it to the GAC. I then
> added the reference to it in the Solution Explorer. But now when I
> type the expression I get a "identifier expected" error in the
> expression editor.
>
> I want to get a file named "salestracing_042705.txt".
>
> Here is my expression and the source code for the assembly:
>
> Expression:
> ------------------------------
> SetFileName = Claflin850;
> FileType = "SalesTracing";
> SetFileName(FILE.ReceivedFileName) =
> NameOutputFile.NameOutputFile.(FileType);
> -----------------------------
>
> Assembly source:
> ----------------------------
> using System;
> using Microsoft.XLANGs.BaseTypes;
>
> namespace NameOutputFile
> {
> /// <summary>
> /// This class takes a string and adds "MMDDYY.txt".
> /// </summary>
> [Serializable]
> public class NameOutputFile
> {
> // public NameOutputFile()
> // {
> // }
> public string NameTheFile(string FileType)
> {
> string OutputFileName;
> DateTime dt=DateTime.Now;
> string Date;
>
> Date = dt.ToString("MMddyy");
>
> OutputFileName = System.String.Concat(FileType, "_", Date,
> ".txt");
>
> return OutputFileName;
> }
> }
> }
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com