Weight Values from Children

User Rating: / 0

This generation rule is a variant of the Weighted List generator. It's purpose is to generate values from a list weighted values. But in that case, the values and the associated weights are initialized from the source field.

So the principle is to fill the list of weighted values during the initialisation and then to select those values using their weight afterwards. During the initialisation, the source field is traversed until it becomes exhausted. That means that you must take care that the source field will indeed exhaust at some reasonable point.

A typical use of that generation rule is to load values from a external source (such as a reference file) and to build a sequence of pairs <weight><separator><value> from that source using appropriate extract and transform processings.

For example, consider the folowing file containing census data with city names, state and population :

162,01,00124,Abbeville city,Alabama,2688,2688,2689,2704
162,01,00460,Adamsville city,Alabama,4522,4522,4522,4525
162,01,00484,Addison town,Alabama,758,758,754,754
162,01,00676,Akron town,Alabama,356,356,354,348
162,01,00820,Alabaster city,Alabama,30352,30352,30473,30799

And we want to generate city names using their population as weight. Doing so, we can for example generate adresses conforming to real population density. To do so, we need to convert each source line by extracting first the population density (column 6) and city name (column 4).

So the source of the Weigth Values List should be a column extract from a file extract.

Add comment

Security code