ReferenceValue

ReferenceValue

Generates values for referencing field by following the reference and randomly (following the specified distribution) picking a row from the value set (rows) of the referenced table and recalculating its value. Default timeIDOffset = 0

Attributes
Name Description Required Min Max Allowed Values
timeIDOffset Content type: Long
Offset for the timeID this generator is going to use (e.g., if fixed time frame mode is used: refTimeID = offset + gc.timeID). Default offset is 0
no 0 1
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
choose supported modes: [randomShuffle, random, permutationRandom, relativeUnique_withoutDeletedInNextUpdate, relativeRowMapping, directRowMapping, sameChoiceAs, globalUnique, intraTupel, idFromSubGenerator, relativeUnique] yes 1 1
  • randomShuffle
  • random
  • permutationRandom
  • relativeUnique_withoutDeletedInNextUpdate
  • relativeRowMapping
  • directRowMapping
  • sameChoiceAs
  • globalUnique
  • intraTupel
  • idFromSubGenerator
  • relativeUnique
from supported modes: [fixedTimeFrame, atInsert, historical, sameTimeFrame, relativeTimeFrame] yes 1 1
  • fixedTimeFrame
  • atInsert
  • historical
  • sameTimeFrame
  • relativeTimeFrame
id Identification String of this element. May be used to uniquely identify a field within the children of an Element. no 0 1
includeDeletedIDs Content type: Boolean
When generating references to an update table, also include already deleted IDs.
no 0 1
  • true
  • false
  • 0
  • 1
timeIDMAX Content type: Long
Maximal chosen timeID this generator is going to use relatively to the current timeID in GenerationContext.getTimeID() (or Default max is 'last timeID in table').
no 0 1
Nodes
Name Description Required Min Max Allowed Values
reference reference yes 1 1
distribution Distribution to be used by a generator when calculating a value no 0 1
sameChoiceAs Content type: Empty
Requires a <field> and a <generatorByID> attribute (in same table) to pick the row number from. If specified this ReferenceValue does not choose a random row, but it uses the same row as the referenced generator.
no 0 1
gen Value Generator for this field no 0 1
  • 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

Examples

  1. Simple Key/Foreign Key

    Generates customers with foreign keys to the NATION table. Hence for every nation id in the CUSTOMER table, there exists a corresponding primary key in the NATION table.

    Schema config for Simple Key/Foreign Key
    <?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>
    
      <!--Simple Key/Foreign Key-->
        <!--
          Generates customers with foreign keys to the NATION table. Hence for every nation id in the CUSTOMER table,
          there exists a corresponding primary key in the NATION table.
        -->
        <!--n_nid (integer, asc.) | n_name (varchar) -->
        <!--base table used for reference -->
        <table name="NATION">
          <size>4</size>
          <field name="n_nid" type="NUMERIC">
            <gen_Id id="n_nid_gen">
              <min>1</min>
            </gen_Id>
          </field>
          <field name="n_name" type="VARCHAR">
            <gen_DictList>
              <file>dicts/country.dict</file>
              <disableRng/>
              <unique/>
            </gen_DictList>
          </field>
        </table>
    
        <table name="CUSTOMER">
          <!-- if tables should scale with -SF command line argument.
               Specify your scaling formula here: -->
          <size>10 * ${SF}</size>
    
          <field name="c_cid" type="NUMERIC">
            <gen_Id>
              <min>1</min>
            </gen_Id>
          </field>
    
          <field name="c_nid" size="" type="NUMERIC">
            <gen_ReferenceValue choose="random" from="historical">
              <reference field="n_nid" table="NATION"/>
            </gen_ReferenceValue>
          </field>
        </table>
        </schema>
    
    Output for Simple Key/Foreign Key
    # NATION
    1|Kyrgyzstan
    2|El Salvador
    3|Lesotho
    4|Bulgaria
    
    # CUSTOMER
    1|2
    2|4
    3|1
    4|3
    5|1
    6|2
    7|4
    8|3
    9|4
    10|2
  2. Sample Values from Reference Table

    Generates customers with a field for country of origin using the NATION table. Hence for every origin field in the CUSTOMER table, there exists a corresponding entry in the NATION table. See also OtherFieldValue generator for the same kind of behaviour within a table.

    Schema config for Sample Values from Reference Table
    <?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>
    
      <!--Sample Values from Reference Table-->
        <!--
          Generates customers with a field for country of origin using the NATION table. Hence for every origin field in
          the CUSTOMER table, there exists a corresponding entry in the NATION table. See also OtherFieldValue generator
          for the same kind of behaviour within a table.
        -->
        <!--n_nid (integer, asc.) | n_name (varchar) -->
        <!--base table used for reference -->
        <table name="NATION">
          <size>4</size>
          <field name="n_nid" type="NUMERIC">
            <gen_Id id="n_nid_gen">
              <min>1</min>
            </gen_Id>
          </field>
          <field name="n_name" type="VARCHAR">
            <gen_DictList>
              <file>dicts/country.dict</file>
              <disableRng/>
              <unique/>
            </gen_DictList>
          </field>
        </table>
    
        <table name="CUSTOMER">
          <!-- if tables should scale with -SF command line argument.
               Specify your scaling formula here: -->
          <size>10 * ${SF}</size>
    
          <field name="c_cid" type="NUMERIC">
            <gen_Id>
              <min>1</min>
            </gen_Id>
          </field>
    
          <field name="c_nid_1" size="" type="NUMERIC">
            <gen_ReferenceValue choose="random" from="historical" id="c_nid_gen">
              <reference field="n_nid" table="NATION"/>
            </gen_ReferenceValue>
          </field>
          <field name="c_origin" size="" type="VARCHAR">
            <!--sample from the NATION table using n_nid -->
            <gen_ReferenceValue choose="sameChoiceAs" from="">
              <sameChoiceAs field="c_nid_1" generatorByID="c_nid_gen"/>
              <reference field="n_name" table="NATION"/>
            </gen_ReferenceValue>
          </field>
        </table>
        </schema>
    
    Output for Sample Values from Reference Table
    # NATION
    1|The Bahamas
    2|Benin
    3|Mali
    4|Botswana
    
    # CUSTOMER
    1|3|Mali
    2|2|Benin
    3|4|Botswana
    4|3|Mali
    5|4|Botswana
    6|3|Mali
    7|1|The Bahamas
    8|2|Benin
    9|3|Mali
    10|3|Mali
2.6_#1486_b758 | 2016-05-24