Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I've tried variations using a context variable, thinking I can load from the table the list, denormalize it, and then load to the context variable. Once that is done, tRowGenerator does it's thing. But I can't get that to work:
I've tried changing the type from String to List, but can't seem to get it to work.
When I hard code the list, TOS generates this following Java code:
public String getRandomCredentials() {
String[] CredentialsTable = new String[] { "MD", "DO",
"FNP", "AGNP", "DDS" };
java.util.Random randomtRowGenerator_1 = new java.util.Random();
return CredentialsTable[randomtRowGenerator_1
.nextInt(CredentialsTable.length)];
}
But when I use a context variable, it doesn't "randomize it". It just returns the values in the context variable as a single string:
public String getRandomCredentials() {
return context.Credentials;
}
Any help is appreciated!
Hi @Papademuchos and welcome to the Community!
I'm afraid your screenshots are not available to view. I have checked the HTML and it looks like you are sharing from Google. This does not allow others to view this. Could you use the Photos button at the top of the post window and add these?
Regarding your question, I think you may need to use a tMap and call the methods using Java in-line IFs to do this. I may be wrong since I am missing the images, but you might want to try that.
Hello, hopefully these images will come through better. The first one is showing the literal string in the Expression Value in tRowGenerator. It accurately randomizes my five values among the generated rows: "AGNP","DDS","DO","FNP","MD".
The second one is my attempt to pull the values from a database table and put them into a context variable. I can do that part just fine, but tRowGenerator doesn't see them as a list of values, but a single value.