Site Map

This Question is Answered

2 "helpful" answers available (2 pts)
8 Replies Last post: May 19, 2008 10:00 AM by lpd@equinetconsulting.com  
Click to view lpd@equinetconsulting.com's profile   13 posts since
May 15, 2008

May 15, 2008 3:33 PM

Format function needed

I believe a Format( string, format ) Expression function is needed to format string expressions for output fields (i.e. 123 > $123.00). Thx.
Click to view ibrahim's profile   6 posts since
Aug 15, 2007
Here is a sample for calling external .net functions from DataMapper 2008.


using System;
using System.Collections.Generic;
using System.Text;
using Astera.Core; // Add Astera.Core.Dll to your project references. This dll is in the DataMapper installation folder.


namespace CustomRuleFunctionSample
{
/// <summary>
/// This class represents a sample for defining custom rules expression functions.
/// All classes containing rule functions must have attribute RuleFunctionClass.
/// All functions must be declared public static and must have Function attribute.
/// Other attributes are optional. However, it is recommended that you provide
/// description of parameters and the category attribute. This information is
/// displayed as tooltips in the rule expression editor and expression builder.
/// A class may contain multiple custom functions.
///
/// Once compiled, the dlls must be dropped in PlugIn folder under the program
/// files\Astera Software\Product Name folder. Create the folder if it is not there already. The folder must be named "PlugIn".

//These DLLs are automatically picked up at the application startup and the functions will show in rule function lists
/// and intellisense dropdowns.
/// </summary>
RuleFunctionClass
public class CustomFunctionSample
{

public static string Concatenate(string str1, string str2)
{
return string.Format("{0}{1}", str1, str2);
}
}
}

Click to view ibrahim's profile   6 posts since
Aug 15, 2007
Add Astera.Core.Dll in your project reference. This dll is in the install directory.
Click to view mike's profile   11 posts since
Aug 10, 2007

You can actually find this assembly, as well as the entire sample project, under the Astera Software folder created when you installed the product. For example, if you used the default location and C:\ is your windows drive, you can find it here: C:\Program Files\Astera Software\DataMapper 2008 Development Samples. In this directory, you'll find a zip file that has the project, reference, Astera.Core.dll assembly, and a sample class at your disposal.