Biztalk Expression Editor String Operations
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > Biztalk Expression Editor String Operations




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Biztalk Expression Editor String Operations  
njhudson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-27-05 01:46 AM

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".






[ Post a follow-up to this message ]



    RE: Biztalk Expression Editor String Operations  
Stephen W. Thomas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-27-05 12:55 PM

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".
>
>





[ Post a follow-up to this message ]



    re:Biztalk Expression Editor String Operations  
njhudson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-28-05 01:50 AM

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;
}
}
}






[ Post a follow-up to this message ]



    re:Biztalk Expression Editor String Operations  
Stephen W. Thomas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-28-05 07: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 s
hape?

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;
> 		}
> 	}
> }
>
>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:47 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register