hey guys i am just doing a small project in dynamics AX 2012 as i am beginner and new to AX.
In sells form i want to take multiple record at a time and then want to save these data into my sellsTable(table name) and each record consists of these fields that is sellsid, itemid, itemname, itemquantity, itemunitprice, totalcost, date.
so suggest me how should i procceed.
i guess its same question and answer as here
then, I am unable to understand your issue/ scenario
sohaib it may be the answer i dont know excatly .
as i am very new to dynamics AX so i am unable to handle complex things .
my issue is that
i want to take value (multiple record) from grid and want to store into my sell table
and the scenario is that ..
i have made one sellsform(Form Name) for handling the billing regarding selling of products .
so i know how to take a single record from the form by using StringEdit but i dont know how to take multiple record from form .
i can use this StringEdit also here ..but what will happen when a customer buy more than one item at a time .so to overcome this problem i want to take multiple records at a time
my project is of supermarket
Gentleman you have to use grid and set multiselect property of grid as true.
ok sohaib i have done this ..and one more thing how to get the values from the same grid
as i have created this grid without any datasource
As I referred to a previous post
yourTableObject = YoueTable _ds.getFirst(true);
//any processing here any logic here;
//for your case you have to insert records in other tables here
yourTableObject = YoueTable _ds.getNext();
I cannot understand why you are not using Datasource for your form, is there any special need, for not using DS??
hey sohaib where should i write these codes
i mean i need to override any method of grid ??
if not then where should i ?
ok sohaib . let me answer it
i am not using the datasource in grid because when i add the datasource then it will display the values from the table which i don't want .
suggest me what to do here ,if it is necessary to add DS then i will definetly add the DS
so you want, as the records go into your destination table, the records should be deleted from source form..???
From which table you are getting data to Sells form??
As per your question you have a sells form from there you want to store the selected records into sells table..I'm i right?
If yes then create a button in the sells form then override the clicked method with the sohaib logic..
hope its clear.
yeah ..exactly sohaib
ya you are right shiva
Make a copy of your destination table. Now take this copy of destination table and set its TableType property to TempDB. now use this newly created temporary table as your DS in Source Form.
Check this post:
The code Shiva provided requires the record to be "marked" (check the post to see what does marked mean in this context) to work.
This same post provided two possible solutions
My blog | PBC
This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
ok paste the below code on the clicked method of your button..
it will delete the selected records from the TempDB table & inserts the same into SellTable..
_Table1 = TempDB_ds.getfirst(true);
sellstable.Field1 = _Table1.Field1;
sellstable.Field2 = _Table1.Field2;
delete_from Tab1 where Tab1.RecId == _Table1.RecId;
_Table1 = TempDB_ds.getnext();
Let me know if any..