Padding

Padding

Pads the value generated by another generator to a fixed length field. Either specify a sub-generator or run another generator using a Sequential before this one to provide a string suitable to being formatted.

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
size Content type: Long
Final size of value. If the sub-generator of this generator produced a string shorter than the specified size, the value will be padded with the characters as specified in 'character'. If the generated value is too long, it will be truncated to the specified 'size'.
no 0 1
character Content type: Character
Sets the character this generator uses for padding fields (instead of the default whitespace)
no 0 1
padToLeft Content type: Boolean
If this is true, fields are padded to the left, else to the right
no 0 1
  • true
  • false
  • 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. Pad to Right with #'s

    Pads the output of the RandomString generator with hash signs ('#') to the right.

    Schema config for Pad to Right with #'s
    <?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="PADDING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Pad to Right with #'s-->
          <!--Pads the output of the RandomString generator with hash signs ('#') to the right.-->
          <field name="pad_with_hashes_right" size="" type="VARCHAR">
            <gen_Padding>
              <size>8</size>
              <character>#</character>
              <gen_RandomString>
                <min>4</min>
                <max>6</max>
              </gen_RandomString>
            </gen_Padding>
          </field>
          </table>
    </schema>
    
    Output for Pad to Right with #'s
    Ns0Vm###
    G0ql0N##
    EYoGh###
    MWIvxI##
    kns7####
    NTHg####
    4zUKE0##
    BFEs####
    3XKf####
    oshVv###
  2. Pad to Left with #'s

    Pads the output of the RandomString generator with hash signs ('#') to the left.

    Schema config for Pad to Left with #'s
    <?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="PADDING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Pad to Left with #'s-->
          <!--Pads the output of the RandomString generator with hash signs ('#') to the left.-->
          <field name="pad_with_hashes_let" size="" type="VARCHAR">
            <gen_Padding>
              <size>8</size>
              <character>#</character>
              <padToLeft>true</padToLeft>
              <gen_RandomString>
                <min>4</min>
                <max>6</max>
              </gen_RandomString>
            </gen_Padding>
          </field>
          </table>
    </schema>
    
    Output for Pad to Left with #'s
    ##a9hGk3
    ###i4tQn
    ###WSsbI
    ###Q86Es
    ##nC7i9m
    ##1DaVZU
    ##nHa21r
    ####Xc7v
    ###yed2L
    ##1P8cIr
2.6_#1486_b758 | 2016-05-24