ExecStrCommand Method

[Top]  [Chapter]  [Previous]  [Next]

Applies to

IWPFieldContents

Declaration

procedure ExecStrCommand(CommandID: Integer; param: Integer; const StrParam: WideString);

 

CommandID = 1:

Set the state of the field using the parameter 'param' inside the event OnFieldGetText. The State is used for band conditions of the integrated reporting.

 0: Default value

 1: Field is not known (default if checking field and band conditions, i.e. ?field=null )

 2: Field is defined and NULL

 3: Field is defined and ZERO

 4: Field is defined (set this value unless it is null or zero)

Example - Simulate certain conditions:

private void wpdllInt2_OnFieldGetText(object Sender,

   int Editor, string FieldName, IWPFieldContents Contents)

       {

          // test the conditions

          if (!Contents.IsMergefield)

           {

              if (FieldName == "ISNULL")

                   Contents.ExecStrCommand(1, 2, "");

              else if (FieldName == "ISZERO")

                   Contents.ExecStrCommand(1, 3, "");

              else if (FieldName == "ISUNDEF")

                   Contents.ExecStrCommand(1, 1, "");

              else

               {

                   Contents.ExecStrCommand(1, 4, ""); // Known

                   Contents.StringValue = "123";

               }

           } else

           ....

       }

 

This conditions can be used inside band tokens like in this simplified sample (See Token to Template Conversion):

 

tokens_conditions

 

Other CommandIDs:

This method can be extended for custom manipulations of the inserted text - if you have a wish please let us know.


[idh_iwpfieldcontents_execstrcommand.htm]    Copyright © 2007 by WPCubed GmbH