how to fetch the value of my current fields as my default value when creating new records.
let say in my product model i have existing value of my fields which is field1 = 5 and field2 = 10 period Jan 1- 7, 2014.
what I want to achieve is on the next period dated Jan 8 - 14, 2014 or the next enter of the new inventory record for product1 else product2. I want to fetch previous value of field1 and field2 as the default value of my new field1 and field2.
currently i have custom product and inventory modules and 2 reserve fields in inventory module but Im stuck. I dont know how to implement. is very complicated because that 2 fields always been change, my Idea is to update that fields but I think I cant go back to my previous reports after created the new inventory records for the specific product because the value is changed.
anybody here who can give Idea on how to do it and best way to implement this?.
This for custom weekly period monitoring inventory to my custom product
Thanks for reading
Hi Philip , while creating the record for the period jan 8 -14 2014 for a specific product , you can check whether there is any record has been created previously for the product.
If created then you can get the value from that record order by date descending and get the values for field 1 and field2 from that record else the value for field 1 and field 2 will be empty in case this is a new record for the product
Let us take the example of Class A
1) In create method, check the class if already any record exists order by id or not
2) if records exists, then browse the value from searched record and update it to your newly creating record.
3) if record does not exist, then you can give your own values to the fields.
Is this Clear
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 11/5/14, 11:01 AM|
|Seen: 702 times|
|Last updated: 3/16/15, 8:10 AM|