Data Generator - Dependant on another column value

Discussion of open issues, suggestions and bugs regarding database management and administration tools for MySQL
Post Reply
cdunn66
Posts: 5
Joined: Mon 24 May 2021 05:02

Data Generator - Dependant on another column value

Post by cdunn66 » Tue 25 May 2021 05:34

Hi Support,

Would you be able to explain how I might configure Data Generator to use one of its generator functions but have this dependant on another column value?

I will try to explain by way of a made up example.

Say I had a Product Table, which had the following columns
Product Id <- Generator (Sequential Id)
Product Type <- Table Lookup (Two possible values 1 - External / 2 - Internal)
Product Name <- Generator (Product Name)
Product Price <- Generator (Decimal - Min/Max Range)

Above is all straightforward, but what if I only wanted to set a Product Price if the Product Type = 1 (eg External). How would I do this?

dzhanhira
Devart Team
Posts: 239
Joined: Mon 26 Oct 2020 13:49

Re: Data Generator - Dependant on another column value

Post by dzhanhira » Tue 25 May 2021 09:12

To implement such dependencies, you need to use a Python generator.
Examples of python scripts can be found here: http://docs.devart.com/data-generator-f ... rator.html

cdunn66
Posts: 5
Joined: Mon 24 May 2021 05:02

Re: Data Generator - Dependant on another column value

Post by cdunn66 » Wed 26 May 2021 04:53

Many thanks...Will give it a go.

Post Reply