Hello
I am using model driven development. I am using getAll in the Fill method. But the results are not returned sorted by some field that I am interested in. How do I tell the Fill to sort it by some field. Is there some annotation that I can provided in the model...
thanks
RK
Solved! Go to Solution.
Views
Replies
Total Likes
You should be able to achieve what you want with an explicit criteria filter on your entity.
In the Modeler Design view, select your entity and add a filter. You'll see that there is a an "Order By" field in the Properties view.
Enter the value you want there and then save and redeploy your model. When you don't enter anything in the "Criteria" field, you create a getAll fill.
Here's an example of an entity created with this type of filter; it is sorted by price in ascending order:
<entity name="Product" persistent="true">
<annotation name="ServerProperties" ServerType="LCDS"/>
<annotation name="DMS" Table="PRODUCT"/>
<annotation name="RDS" introspectedColumns="PRODUCTID,DESCRIPTION,PRICE,PRODUCTNAME"/>
<annotation name="VisualModeler" width="115" height="110" x="364" y="203"/>
<id name="productid" type="integer">
<annotation name="DMS" ColumnName="PRODUCTID"/>
</id>
<property name="description" type="string" length="255">
<annotation name="DMS" ColumnName="DESCRIPTION"/>
</property>
<property name="price" type="float">
<annotation name="DMS" ColumnName="PRICE"/>
</property>
<property name="productname" type="string" length="255">
<annotation name="DMS" ColumnName="PRODUCTNAME"/>
</property>
<filter name="MyFill" order="price ASC"/>
</entity>
Views
Replies
Total Likes
You should be able to achieve what you want with an explicit criteria filter on your entity.
In the Modeler Design view, select your entity and add a filter. You'll see that there is a an "Order By" field in the Properties view.
Enter the value you want there and then save and redeploy your model. When you don't enter anything in the "Criteria" field, you create a getAll fill.
Here's an example of an entity created with this type of filter; it is sorted by price in ascending order:
<entity name="Product" persistent="true">
<annotation name="ServerProperties" ServerType="LCDS"/>
<annotation name="DMS" Table="PRODUCT"/>
<annotation name="RDS" introspectedColumns="PRODUCTID,DESCRIPTION,PRICE,PRODUCTNAME"/>
<annotation name="VisualModeler" width="115" height="110" x="364" y="203"/>
<id name="productid" type="integer">
<annotation name="DMS" ColumnName="PRODUCTID"/>
</id>
<property name="description" type="string" length="255">
<annotation name="DMS" ColumnName="DESCRIPTION"/>
</property>
<property name="price" type="float">
<annotation name="DMS" ColumnName="PRICE"/>
</property>
<property name="productname" type="string" length="255">
<annotation name="DMS" ColumnName="PRODUCTNAME"/>
</property>
<filter name="MyFill" order="price ASC"/>
</entity>
Views
Replies
Total Likes
It did not help yet.. Here is the FML.. After making the change in model file, If I click on Generate Code..do I expect to see any changes in the auto-gen java code.. I don’t see any change though (like in the assembler file)..
</filter
Views
Replies
Total Likes
My mistake… I was still calling ordersService.getAll() in the client instead of ordersService.FillSortedByTWSTimestamp()..it should be okay now..
The changes are made in the auto-gen AS file instead of java file..
Views
Replies
Total Likes
while it is working, I noticed that my additions to the database using DataServiceTransaction.createItem() have stopped displaying on the client GUI but are making it to the database. If I switch back to ordersService.getAll() from the new method ordersService.getSortedByTWSTimestamp(), then the client GUI is happily updated.. any ideas...
Views
Replies
Total Likes
looks like auto-refresh was set to false for this filter...
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies