Use conditions for bands

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

TextDynamic allows simple conditions for bands. This makes it possible to use some parts of the text depending on the value of a certain field. Of course the field name can be virtual, not existing in the database but known by your code.


To use a condition in a band use the option:


?fieldname=yyy   (see Parameters for Bands and Groups)


To evaluate the specified fieldname the event OnFieldGetText is called. There the property Contents.IsMergeField will be false. Use ExecStrCommand the special states (null, zero, defined) of a field can be specified.



      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, "");



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

                   Contents.StringValue = "123";



          else Contents.StringValue = Convert.ToString(rnd.NextDouble());






[use_conditions_for_bands.htm]    Copyright © 2007 by WPCubed GmbH