Update grid with lookup in D365FO - axapta

I have a form with the datasource SalesTable in D365FO, I have a lookup field showing the SalesId and I want to show the information of the SalesTable in the grid based on what is selected in the lookup. Does anyone have the solution? I have read a lot of blogs but with no information about what I'm looking.

Related

filling a grid with from two different record (table) sources

I was wondering if there is any way to populate a table using two different records. My records have the same primary keys, but when I am adding the specific fields to my grid I have this error:
More than one data (key) in one scroll.
I tried to make a Control view field in my primary record, and then refer the new record fields as relative fields but in this case the data is not populating in my grid. Any help or hint will be much appreciated.
I've only done this where the 2nd record is a Derived/Work record.
Can you create a view that combines both records, and put the view in the grid? FYI, peoplesoft let's you update the data in a view, which is not typical in an oracle db system.
Ok guys finally after all discussion, and much try rounds I figured out how to do this.
You need to add a draw a grid beside your old grid and populate it with a new record, which has dynamic view (dynamic sql). The only important case there, is you need to make sure the order of your fields in your records, are in the same order of your fields in the SELECT statement of your sql. Otherwise you will see
an SQL error
.
Try to make a field as display control field which is acting as primary key for its native table and as Foreign key for some other record.. A field needs to be made related if is being fetched from some other record... that is from the record which is not under current consideration. I think this way one can fetch data into grid or scroll respectively from multiple records.

Advanced editing, insert, delete with datagridview ASP.NET Web Forms

I am moving from windows forms to ASP.NET Web Forms and I run into troubles. I am trying to insert, delete, edit and update. Bellow are two table that i have.
Person table - PersonID, Person
Company table - CompanyID, Company, PersonID
How to use the datagrid properly so that instead of PersonID I use Person field in a dropdown list so that the user can choose a value from and at the same time I can do insert, delete, edit, update.
I hope you get my point here and will help me in a way. Thanks
This can be done easily.
You need to attach a datasource of Company table with the grid, by default it will show person Id. In order to connect it to the person table, change the column of person ID to Template. In the Edit Template import a dropdown and attach another Datasource of Person Table to it. Select Value and Key accordingly.
For a basic Idea have a look at: http://odetocode.com/articles/231.aspx

How to 'bind' query to a grid, in Axapta?

How can i bind a 'complex' query with, for example, 3 joined table to a grid in Axapta ? For 'bind' i intend: show in a grid a list of field in the resulted query ?
If complex then make a query, then drag the query and drop on the Data Sources node.
The joined tables (maybe exclusive exists joined tables) are automatically created for you.
You may then change the nodes.
Any grid should address the first datasource. You drag the grid fields from the created datasources Fields list.
You can do the same without the query using multiple datasources provided proper relations are defined and you use LinkType InnerJoin and JoinSource the first datasource.
See Creating a Form Based on a Composite Query.

How to prepare attendance sheet in asp.net?

I want to add a attendance sheet for HR record purpose, where they save attendance of different employees. Then I have to retrieve those records on different pages on searching respective fields.
If you are using a gridview to accomplish your task you can use the SQLDataSource control which will allow you to perform different commands like insert, edit and update.
Here you can use GridView.DataBind Method to bind data to your gridview.
The article about Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control will give you a better idea of doing
This is rather a database design question then asp.net. Starting from a simple design, first you need to have an Employee table (Call it Employees) with all employee names & secondly an attendance table which will record each employee attendance. Refer to my sample schema

Edit a read-only view

I have a column and I would like to edit some of its rows. The problem is that the table is a view so I cannot edit the rows. How would I proceed to solve this problem?
SQLite doesn't let you update views. But it does allow triggers on views. So you can write an INSTEAD OF UPDATE trigger that makes the appropriate modifications to the underlying table.
As dan04 pointed out, you can use triggers to update views (like in most other databases). For sqlite, see http://www.sqlite.org/lang_createtrigger.html#instead_of_trigger
Example with a view called "myview", containing a table "my_t2"
CREATE TRIGGER myview_update INSTEAD OF UPDATE ON myview
BEGIN
UPDATE my_t2 SET field1 = new.field1, field2 = new.field2 WHERE my_t2.key = old.key;
END
If it's a view, it's not a table. The data for the view is drawn from one or more other tables. Edit the underlying table and when you examine the data in the view it will reflect the changes you made.
A SQL View is a virtual table, which is based on SQL SELECT query. Essentially a view is very close to a real database table (it has columns and rows just like a regular table), except for the fact that the real tables store data, while the views don’t. The view’s data is generated dynamically when the view is referenced. A view references one or more existing database tables or other views. In effect every view is a filter of the table data referenced in it and this filter can restrict both the columns and the rows of the referenced tables.
If you wish to modify the data in your table, you cannot do so with a view. SQL Views are always read-only. If you want to modify your table outside of the View, then use something like an UPDATE or ALTER TABLE statement.

Resources