Hi All,
I created a Fetch Specification named 'DistinctCategories' in my Movie EO, and have select the Distinct rows option. I also have it set to return Specific Attributes as raw rows and have only the category attribute selected. I am linking that to my NewCategoryPop WOPopUpButton through the class property distinctCategories. I need this drop down to represent the newcategory property in my form below. It seems that the NSArray is configuring it with the option value set to the index of the array and the displayString set to the Movie object, not the value of the category. The page displays the same value no pater if I have the item & displayString values set in my Dynamic Component. What am I doing wrong?
Thomas
// Main.java
private Movie acategory; // Stores the value of the Category search field.
private NSArray<Movie> distinctCategories; // Stores the results of a search.
...
public NSArray<Movie> getDistinctCategories() {
return this.distinctCategories;
}
public void setDistinctCategories() {
EOEditingContext ec = session().defaultEditingContext();
NSArray<Movie> distinctCategories = EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "Movie", "DistinctCategories", null);
this.distinctCategories = distinctCategories;
}
...
// Main.wo
NewCategoryPop : WOPopUpButton {
list = distinctCategories;
item = acategory.category;
displayString = acategory.category;
selectedValue = newcategory;
}
My Fetch Specification is set to return a distinct on the category property. That seems to be returning the right number of rows, but I am getting an Object in the WOPopupButton option list.
<form method="post" enctype="multipart/form-data" action="">
<table class="simple">
<tr><td>Title:</td><td><input type="text" name="5.3.1" /></td></tr>
<tr><td>Category:</td><td><select name="5.3.3"><option value="0">{category = "Comedy"; }</option><option value="1">{category = "Drama"; }</option><option value="2">{category = "SiFy"; }</option><option value="3">{category = "Test"; }</option><option value="4">{category = "War"; }</option></select></td></tr>
<tr><td>Date Released:</td><td><input type="text" name="5.3.5" /></td></tr>
<tr><td colspan=2 ><input type="submit" value="Insert" name="5.3.7" /></td></tr>
</table>
<input type="hidden" name="wosid" value="8v9GksUm8D3deHrl4b0VAw" /></form>