If

If

Generates a value based on the output of another generator.

Attributes
Name Description Required Min Max Allowed Values
seed Random number generator seed of this Element. Overrides default seeding behavior. no 0 1
name (Class)Name of this element. Used to identify plugin Class. Full name is required. Example: com.en.myPluginPackage.myPuginClass no 0 1
id Identification String of this element. May be used to uniquely identify a field within the children of an Element. no 0 1
Nodes
Name Description Required Min Max Allowed Values
else Content type: Sub-generator
Contains generator node to execute if <else> formula evaluates to FALSE
yes 1 1
if Content type: Java code
The formula to evaluate. Example: (300 * ( generator[1] + 4 ))/ generator[0]. Any number of sub-generator nodes may be specified after the if and before the then element which can be accessed in the formula. If the formula contains characters of the xml structure (like '<', '>', ...), the formula has to be wrapped into '<![CDATA[ ... ]]'.
yes 1 1
then Content type: Sub-generator
Contains generator node to execute if <then> formula evaluates to TRUE
yes 1 1
staticValue here you can specify static values to be available to use. Example: <staticValue>new int{1,2,3,4,5}</staticValue> no 0 1
gen Value Generator for this field no 0
  • pdgf.generator.MarkovChainText
  • pdgf.generator.AsReferenceChoice
  • pdgf.generator.WeightedListItem
  • pdgf.generator.DetailFromDate
  • pdgf.generator.BuildList
  • pdgf.generator.InsertIntoString
  • pdgf.generator.UUID
  • pdgf.generator.Probability
  • pdgf.generator.RandomString
  • pdgf.generator.Sequential
  • pdgf.generator.ConvertNumberToString
  • pdgf.generator.WeightedSubListItem
  • pdgf.generator.RandomListItems
  • pdgf.generator.Email
  • pdgf.generator.ActionDeleteIsAlsoUpdate
  • pdgf.generator.DoubleNumber
  • pdgf.generator.Permutation
  • pdgf.generator.Switch
  • pdgf.generator.ReferenceValue
  • pdgf.generator.ForFormula
  • pdgf.generator.PrePostfix
  • pdgf.generator.StaticValue
  • pdgf.generator.Hash
  • pdgf.generator.Padding
  • pdgf.generator.FormatString
  • pdgf.generator.DateTime
  • pdgf.generator.Id
  • pdgf.generator.LastChoice
  • pdgf.generator.MaskString
  • pdgf.generator.Null
  • pdgf.generator.AddRandomSeconds
  • pdgf.generator.RandomStringInRange
  • pdgf.generator.Formula
  • pdgf.generator.AbstractDecimal
  • pdgf.generator.FormatFloatingPoint
  • pdgf.generator.OtherFieldValue
  • pdgf.generator.RandomSentence
  • pdgf.generator.FormatNumber
  • pdgf.generator.Template
  • pdgf.generator.BigBenchReview
  • pdgf.generator.UpperLowerCase
  • pdgf.generator.For
  • pdgf.generator.Relative
  • pdgf.generator.RandomUniqeString
  • pdgf.generator.PermutationReference
  • pdgf.generator.UpdateActionType
  • pdgf.generator.FormatNumberAsDate
  • pdgf.generator.OldReferenceGeneratorDeprecated
  • pdgf.generator.DictList
  • pdgf.generator.ExtendedFormula
  • pdgf.generator.FormatDateAsNumber
  • pdgf.generator.If
  • pdgf.generator.GlobalRowNumber
  • pdgf.generator.LongNumber
  • pdgf.generator.UnsafeDistinct
Sub-Attributes
Parent Name Description Required Min Max Allowed Values
staticValue unlockFullAccess Content type: Boolean
Omits complexity restriction. This allows to enter ';' into the if and staticValue elements to be able to enter multiple commands into one line.
no 0 1
  • true
  • false
  • 0
  • 1
if unlockFullAccess Content type: Boolean
Omits complexity restriction. This allows to enter ';' into the if and staticValue elements to be able to enter multiple commands into one line.
no 0 1
  • true
  • false
  • 0
  • 1

Example

  1. Random Gender

    Generates 'female' or 'male' based on a random number 0 or 1.

    Schema config for Random Gender
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--
    /*******************************************************************************
    * Copyright (c) 2013, bankmark and/or its affiliates. All rights reserved.
    * bankmark UG PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    ******************************************************************************/
    --><schema xmlns:doc="http://bankmark.de/pdgf/doc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="demo" xsi:noNamespaceSchemaLocation="structure/pdgfSchema.xsd">
      <!-- All data is derived from this starting seed.
           If this seed is the same, the generated data will the same on each
           computer/node/platform.
           Change this seed to generate a different data set.-->
      <seed>1234567890L</seed>
    
      <rng name="PdgfDefaultRandom"/>
    
      <!--Default Scale factor for all tables -->
      <property name="SF" type="double">1</property>
    
      <table name="IF">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Random Gender-->
          <!--
            Generates 'female' or 'male' based on a random number 0 or 1.
          -->
          <field name="gender" size="" type="VARCHAR">
            <gen_If>
              <!-- sub-generator -->
              <gen_LongNumber>
                <min>0</min>
                <max>1</max>
              </gen_LongNumber>
              <!-- evaluates to true when sub-generator produces 0, false otherwise -->
              <if><![CDATA[((Number) generator[0]).longValue() == 0]]></if>
              <then>
                <gen_StaticValue>
                  <value>female</value>
                </gen_StaticValue>
              </then>
              <else>
                <gen_StaticValue>
                  <value>male</value>
                </gen_StaticValue>
              </else>
            </gen_If>
          </field>
          </table>
    </schema>
    
    Output for Random Gender
    male
    male
    male
    female
    male
    female
    male
    male
    male
    male
2.6_#1486_b758 | 2016-05-24