bottom

CSV Sequence from a Single Source

This rule produces a CSV sequence of an arbitrary number of values from a single source field. The size and values of the generated sequences are provided by two source fields. It is then possible to have sequences of varying lengths and values from one record to the next.

Usage Example: A Variable Length Random Word Generator

To demonstrate how to use this generation rule you can design a random word generator with variable lengths and controlled character frequencies following these steps:

  • Create a new field and choose the CSV Sequence from a single source rule,
    • Left empty the CSV separator
    • Do not check the update and reset check-boxes
  • Select the child field named source and choose the weighted list rule,
    • Fill the weigthed list with items made each of a single character,
    • For each item choose a weight that matches the frequency of that character in the words
  • The select the other field named counter and select also the weighted list generation rule
    • This time fill the list with numbers that will be the lengths of the generated words,
    • The weights will be the frequency of words with that length

This is it, you have designed a random word generator where you can control the frequency of the words for any given length and the frequency of each character of the alphabet.

Configuration of the Rule Builder

To configure this generation rule you have to define two sources, one that generates the number of items in the sequences and another one that generates the values in the sequences. There are two additional parameters for controlling if the generator providing values should be updated or restarted when building a sequence.

CSVSequence

To figure-out how to use this powerful rule let us consider a situation where the number of values in the sequences are provided by rule of type "Arithmetic Sequence". Doing so, the successive sequences generated by this rule will have first 1 value, then 2 values, the 3 values and so on.

On the other hand, consider that the field providing the values of the sequences is associated to a rule providing letters in alphabetic order, that is the first value is "A", then "B", etc.

Based on this configuration and a coma character "," for the separator, the "CSV Sequence for Single Source" rule can produce different sequences depending how you choose to update and to restart the field used for the source values.

Option 1 : The source of value is not updated and neither restarted.

You can notice is this case that even if the flag on the update the source of values is not set the source is updated each time a new record is about to be generated.

Record
Number
Source for
Nb Values
Source for
Value
Generated
Value
1 1 A A
2 2 B B,B
3 3 C C,C,C

Option 2 : The source of values is updated but not restarted

In this second configuration we activated the update of the source value, which means that the source field will be asked to produce a new value for each item in a same sequence. Therefor, the resulting data we obtain are exposed in the following table:

Record
Number
Source for
Nb Values
Source for
Value
Generated
Value
1 1 A A
2 2 B B,C
3 3 C D,E,F

Option 3 : The source of values is not updated but resetted

In this third configuration, the source field providing the sequence's values is not updated but resetted when starting a new sequence. It means that the sequence will me made of only the first value of the source (the one generated just after the reset).

Record
Number
Source for
Nb Values
Source for
Value
Generated
Value
1 1 A A
2 2 B A,A
3 3 C A,A,A

Option 4 : The source of values is both updated and resetted

In this last configuration, the source field providing the sequence's value is both updated and resetted:

Record
Number
Source for
Nb Values
Source for
Value
Generated
Value
1 1 A A
2 2 B A,B
3 3 C A,B,C

Add comment


Security code
Refresh