-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to add a "computed" field to distinguish between genders? #428
Comments
I did this using API call (json file) ...
The "Hidden" value in the 'title' attribute triggers a change I made to DataGenerator.class.php file (under resources/classes directory) which allows me to do computations in the json file and pass those values to fields later on in the data generation. If you were to use the values, as written above, you will see 4 output fields where I'm only seeing the last one. The "nRw" line is simply an extra line of json (data generator ignores this) that I use to help with keeping track of "ROW" #'s in the json file. Hope this helps. Good luck. |
I found a workaround with the existing functionality. Now Field3 is the gender and Field4 has a correspondig firstname |
Conrad - Looks like we've pretty much hit the same workaround with the exception that I'm using a listType where you're using a Constant Loop. End result is the same. :-) I only added the Hidden piece because I didn't want the final output to display (in your case Field1, Field2, and Field3) - only the last calculated field (Field4) is what I wanted to be visible. |
Thank you for your reply. |
Interesting scenario! And thanks for responding, @glad2badad and @conradhagemans. I've been thinking about this - and some other limitations with the tool - and what I think I'll do is create a new Data Type purely for outlier cases like this. The purpose of this Data Type would be to to access any metadata from any data generated in the row. You can then use that programmatically to do whatever you need. To explain: when a Data Type generates something to output, like a name, it generally just returns a value for outputting to the results. But it can also provide optional "metadata" for use by other data types (I confess, Name doesn't right now - but I'll add it!). For example, Region reads the current Country to output something appropriate, and City reads the current Region. That allows for some syncing up of the data so you see a country-region-city that are connected to one another. I added this feature for precisely this reason, so Data Types could be smarter and generate data that makes more sense as a whole. This new Data Type ("Computed" seems as good a name as any!) would be like Composite in that you could use Smarty to access a field in the row Yeah, cool! I like it. Let me tinker with it a bit. I'll try to get it out today. |
Generate data allows the generation of male or female names. How to add a "computed" field to distinguish between genders after generation? i.e if we selected a male name, a field should state "Male" for example.
The text was updated successfully, but these errors were encountered: