expression - sample code

How do I programmatically evaluate the expression?

VBA (MS Access, Excell...)

With Expression1
	.Expression = "currency(value)"
	Debug.Print( .Evaluate("value=100") )
End With

VB6

With Expression1
	.Expression = "currency(value)"
	Debug.Print( .Evaluate("value=100") )
End With

VB.NET

With Expression1
	.Expression = "currency(value)"
	Debug.Print( .get_Evaluate("value=100") )
End With

VB.NET for /COM

With AxExpression1
	.Expression = "currency(value)"
	Debug.Print( .get_Evaluate("value=100") )
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXPRESSIONLib' for the library: 'Expression 1.0 Control Library'

	#import <Expression.dll>
	using namespace EXPRESSIONLib;
*/
EXPRESSIONLib::IExpressionPtr spExpression1 = GetDlgItem(IDC_EXPRESSION1)->GetControlUnknown();
spExpression1->PutExpression(L"currency(value)");
OutputDebugStringW( _bstr_t(spExpression1->GetEvaluate("value=100")) );

C++ Builder

Expression1->Expression = L"currency(value)";
OutputDebugString( PChar(Expression1->Evaluate[TVariant("value=100")]) );

C#

expression1.Expression = "currency(value)";
System.Diagnostics.Debug.Print( expression1.get_Evaluate("value=100").ToString() );

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:B33F5489-49AC-4155-98E7-9BBFC57FF019" id="Expression1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	Expression1.Expression = "currency(value)";
	alert( Expression1.Evaluate("value=100") );
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:B33F5489-49AC-4155-98E7-9BBFC57FF019" id="Expression1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With Expression1
		.Expression = "currency(value)"
		alert( .Evaluate("value=100") )
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

axExpression1.Expression = "currency(value)";
System.Diagnostics.Debug.Print( axExpression1.get_Evaluate("value=100").ToString() );

X++ (Dynamics Ax 2009)

public void init()
{
	;

	super();

	expression1.Expression("currency(value)");
	print( expression1.Evaluate("value=100") );
}

Delphi 8 (.NET only)

with AxExpression1 do
begin
	Expression := 'currency(value)';
	OutputDebugString( get_Evaluate('value=100') );
end

Delphi (standard)

with Expression1 do
begin
	Expression := 'currency(value)';
	OutputDebugString( Evaluate['value=100'] );
end

VFP

with thisform.Expression1
	.Expression = "currency(value)"
	DEBUGOUT( .Evaluate("value=100") )
endwith

dBASE Plus

local oExpression

oExpression = form.EXPRESSIONACTIVEXCONTROL1.nativeObject
oExpression.Expression = "currency(value)"
? Str(oExpression.Evaluate("value=100")) 

XBasic (Alpha Five)

Dim oExpression as P

oExpression = topparent:CONTROL_ACTIVEX1.activex
oExpression.Expression = "currency(value)"
? oExpression.Evaluate("value=100") 

Visual Objects


oDCOCX_Exontrol1:Expression := "currency(value)"
OutputDebugString(String2Psz( AsString(oDCOCX_Exontrol1:[Evaluate,"value=100"]) ))

PowerBuilder

OleObject oExpression

oExpression = ole_1.Object
oExpression.Expression = "currency(value)"
MessageBox("Information",string( String(oExpression.Evaluate("value=100")) ))

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComExpression to "currency(value)"
	Showln (ComEvaluate(Self,"value=100"))
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oExpression

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oExpression := XbpActiveXControl():new( oForm:drawingArea )
	oExpression:CLSID  := "Exontrol.Expression.1" /*{B33F5489-49AC-4155-98E7-9BBFC57FF019}*/
	oExpression:create(,, {10,60},{610,370} )

		oExpression:Expression := "currency(value)"
		DevOut( Transform(oExpression:Evaluate("value=100"),"") )

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN