Easy Questions

Posts   
 
    
Testit
User
Posts: 4
Joined: 31-Jul-2006
# Posted on: 31-Jul-2006 12:25:56   

How do the following using llblGen in this simple scenario i have two tables Product table ProductId,ProductName , price etc

Serial Table productID,serial ,etc

Now when i fetch serials from product entity and bind it to grid like dataGridView1.DataSource = product.Serials it show productid serial etc but i want to return productid productName serial etc ie grab productname from product table how i do that?

Seconde question how to return some field from the table not all i mean Select productId,Name From Products Not Select * from Products

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 31-Jul-2006 17:16:45   

Hi,

1st question:

You can edit your "serial" entity in the designer, and in the "fields on related fields" add the field that you want to appear in the gridview.

Alternatively, you can edit your grid column templates, and manually implement the itemdatabound to display the desired properties, which you can access through the serialItem.Product.xx, provided you did a complete fetch (using prefetch paths)

2nd question:

You can use TypedLists to return custom sets: Those are custom datatables that you can define from within the designer but also dynamically at runtime.

See the reference manual for that

Actually using a typelist can also fit your needs from the 1st question

Testit
User
Posts: 4
Joined: 31-Jul-2006
# Posted on: 01-Aug-2006 14:22:51   

Jessynoo wrote:

Hi,

1st question:

You can edit your "serial" entity in the designer, and in the "fields on related fields" add the field that you want to appear in the gridview.

Alternatively, you can edit your grid column templates, and manually implement the itemdatabound to display the desired properties, which you can access through the serialItem.Product.xx, provided you did a complete fetch (using prefetch paths)

2nd question:

You can use TypedLists to return custom sets: Those are custom datatables that you can define from within the designer but also dynamically at runtime.

See the reference manual for that

Actually using a typelist can also fit your needs from the 1st question

Thanks for your replay I created fields on related fields but it works with some tables and not working with others even if all the tables have the same relation with the serial entity any suggest why this happend?

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 01-Aug-2006 15:11:39   

Could you please provide some more information:

  • the structure of the tables concerned (a piece of schema can help)
  • the changes you made in the designer
  • the code that you are using
  • the description of what goes wrong (like the trace stack of some exception raised)

Thanks in advance. I'm sure we can find an explanation with a little more details.

Testit
User
Posts: 4
Joined: 31-Jul-2006
# Posted on: 01-Aug-2006 15:43:03   

Jessynoo wrote:

Could you please provide some more information:

  • the structure of the tables concerned (a piece of schema can help)
  • the changes you made in the designer
  • the code that you are using
  • the description of what goes wrong (like the trace stack of some exception raised)

Thanks in advance. I'm sure we can find an explanation with a little more details.

Thanks for your replay i Have the following

Item Table { itemID PK Name quantity }

Serials Table { serialID PK itemID FK serial SupplierID FK }

Supplier { supplierID PK Name } know i want to make Master Details to allow the user edit,save,delet the recored the header have Item information displayed in textbox the Details section displayed in DataGridView i want to dispay the followin Columns Headers

SerialID Serial ItemName SupplierName

i did the following in the fields on related fields i select SerialEntity and added two properties one from Item Table i called it ItemName the other from Supplier Table i calles it SupplierName

the selected serial recored already have ItemID and SupplierID entered and i can select it using normal join query know i written the foolowing code

       public ItemEntity GetItemByID(int id,bool full)
    {
        DataAccessAdapter adabter = new DataAccessAdapter();
        ItemEntity toReturn = new ItemEntity(id);

        PrefetchPath2 path = null;
        if (full)
        {
             path = new PrefetchPath2((int)SalesManagement.EntityType.ItemEntity);
             path.Add(ItemEntity.PrefetchPathSerials);

        }
        adabter.FetchEntity(toReturn, path);
        return toReturn;



    }

when i call this method like ItemEntity item=manager.GetItemByID(1,true); dataGridView1.DataSource = item.Serials ; all things displayed correctly including ItemName (which i created like suppliername)i t dose not displayed any thing i hobe this clarify my problem Thanks in advance

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 01-Aug-2006 16:05:33   

You should extend your prefetch path to include the suppliers:

try changing :

path.Add(ItemEntity.PrefetchPathSerials);

into

path.Add(ItemEntity.PrefetchPathSerials).SubPath.Add(SerialsEntity.PrefetchPathSupplier);

(or what your intellisense gives you similar since I'm typping on the fly)

should do it...

Testit
User
Posts: 4
Joined: 31-Jul-2006
# Posted on: 01-Aug-2006 16:13:51   

Thanks it works