populate field from SQL lookup?
amccollough
Posts: 5
I'm working on a data generator project where I would like to be able to do a query against a table containing lookup data.
You know how when scripting data generation fields, other fields are represented like $[Division]? I'd like to be able to do a SQL Query like this: "
Is this possible?
You know how when scripting data generation fields, other fields are represented like $[Division]? I'd like to be able to do a SQL Query like this: "
" and have the result (presuming there would be one record returned) be the data for that column/row instance.SELECT BusinessUnit FROM tblBusinessUNITS where Divsion = '$[Division]'
Is this possible?
Comments
SQL Data Generator has the ability to run a Python script, so if you have a Python script, variable declarations typically begin with the dollar-sign ($). The question must be, how to get a generated column value and use that in a SQL query. This sounds like you would need a combination of two generators - cross-column and SQL statement.
The best solution I can think of for this is to use the Python generator, get the column name into a variable and use Python to get the data.
If i setup the foreign key on DeliveryAddress back to the participants table then it will only select unique part_id when a participant could have multiple delivery addresses.
There is a hint to the right of the "Population method" on the Foreign key generator UI stating: If the foreign key references a single column, each value in the referenced column is only used once. I have tested this and it creates a one to one foreign key.