Question

I have a breeze EntityQuery that is only returning one field of data from my database and ignoring getting rest of the data. It returns the "id", but not the "fname" or "lname" selected field values. Here is my query:

            return EntityQuery.from('Personnels')
            .select('id', 'fname', 'lname')
                .toType('Personnel')
                .using(manager).execute()
                .then(querySucceeded, _queryFailed)

this is what my model looks like:

    public class Personnel
    {
       public Personnel(){}

       //[Key]
       public int Id { get; set; }
       public string Dsn { get; set; }
       public string Fname { get; set; }
       public string Lname { get; set; }

my sql server database looks like this:

enter image description here

And this what my elements looks like during debug. You can see ng-binding has nothing for fname or lname(red arrows) and it is returning an id field value of 8 from database (arrow in green):

enter image description here

And my html code looks like this:

                    <div data-cc-widget-header title="{{vm.title}}"
                     subtitle="{{vm.employees.length}}"></div>
                <div class="widget-content user">
                    <div class="padd" data-ng-repeat="e in vm.employees">
                        <div class="user">
                            <div class="user-details">
                                <h2>firstname is {{e.fname}}</h2>
                                <h2>lastname is {{e.lname}}</h2>
                                <h3>id is {{e.id}}</h3>
                            </div>
                        </div>
                    </div>"

I am working through using hottowel sample from John Papa. Why would this not pickup my other selected fields (lname and fname). It return 1600 records, but only the "id" column?

thanks community Nick

Was it helpful?

Solution

Your select syntax is incorrect. The property names should all be in a single string:

        return EntityQuery.from('Personnels')
        .select('id, fname, lname')

See the Breeze query examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top