5 Replies Latest reply on Nov 10, 2011 10:56 AM by RupakKhurana

    How to Fill Sorted Data with model Driven Development

    RupakKhurana Level 1

      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

        • 1. Re: How to Fill Sorted Data with model Driven Development
          Mike Peterson Level 1

          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>

          • 2. Re: How to Fill Sorted Data with model Driven Development
            RupakKhurana Level 1

            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

            • 3. Re: How to Fill Sorted Data with model Driven Development
              RupakKhurana Level 1

              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..

              • 4. Re: How to Fill Sorted Data with model Driven Development
                RupakKhurana Level 1

                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...

                • 5. Re: How to Fill Sorted Data with model Driven Development
                  RupakKhurana Level 1

                  looks like auto-refresh was set to false for this filter...