Blank Form
Create new HQL datasource
From Clause: Choose entity (table) name
Columns: Enter datafields as from teh Entity. (Case sensitive)
Where Clause: as needed.
Enter Datagrid:
Set the datasource to hql datasource.
Enter columns in grid as per what was created manually in hql columns
Form load can manipulate the where clause:
Sage.Entity.Interfaces.IFxTrans trans =
this.BindingSource.Current as Sage.Entity.Interfaces.IFxTrans;
string tranid = trans.TranId.ToString();
this.QFHqlDataSource.Where = "TranId = " + tranid;
Here are some quick pointers on HQL data sources...
1) You can think of the HQL Data source as a Query builder. The Query is broken up into sections as defined in the HQL data source properties. Columns is the "select" part, From and Where are, well... from and where.
2) The parameters section is used to pass a value into the HQL Query's where clause. Currently, only the Current Entities Id can be passed in "EntityId". Looks like you have that down.
3) The From clause must define the relationship with each entity you want to use. For Example: "Contact c" would reference a single entity, but if you want to activities for that contact, you would put this in the From... "Contact c join c.Activity a". This tells the query to join to activity from contact using the relationship that is defined on the Contact entity that joins to Activity. Tip: you can also use "left join" if it's appropriate.
3) Now you can add all of the Columns you want to use as the "select" part of the Query. Add a column from the Columns property and put the Value you want to use (e.g "c.LastName" or "c.Account"). Add a column for each property you want to use. Tip: Since we are still talking about Entity properties, you can also reference other related entities direcly (e.g. "c.Account.Owner" or "c.AccountManager,UserInfo.Direct"). One warning with using this method, is that is implies an Inner Join, so the entire record will be omitted if any of the properties are Null. Define the relationship in the From property of you need to "allow nulls" with a Left Join.
4) If you want to use an edit form for the main entity in the HQL query, don't forget to include that Id property in your columns. Then , be sure to reference that property on the Key field for your Data Grid (e.g. "c.Id").