FormatString

FormatString

Takes one or more value(s) from subgenerators as argument(s) into a printf style format string.

Attributes
Name Description Required Min Max Allowed Values
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
format Content type: String
Takes values from [1,n] sub generators and formats them "printf style" using format specifiers. e.g: sub generators produce values {'foo', 461012} with format="%-5s|%08d" produces: "00461012".
yes 1 1
gen Value Generator for this field no 0

Example

  1. Complex Composite String of String and Integer

    Generates complex strings composed of a random string and a random integer using the given format string: '%2s/%03d'.

    Schema config for Complex Composite String of String and Integer
    <?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="FORMAT_STRING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Complex Composite String of String and Integer-->
          <!--
            Generates complex strings composed of a random string and a random integer using the given format string:
            '%2s/%03d'.
          -->
          <field name="format_string" size="" type="VARCHAR">
            <gen_FormatString>
              <format>%2s/%03d</format>
              <gen_RandomString>
                <characters>abcdefghijklmnopqrstuvwxyz</characters>
                <min>2</min>
                <max>2</max>
              </gen_RandomString>
              <gen_LongNumber>
                <min>1</min>
                <max>999</max>
              </gen_LongNumber>
            </gen_FormatString>
          </field>
          </table>
    </schema>
    
    Output for Complex Composite String of String and Integer
    wy/594
    kn/865
    hu/204
    xs/740
    mq/020
    jj/212
    ek/234
    mz/359
    gx/383
    fu/419
2.7-83fb0 | 2020-04-22