No data in record to work with in the page

HenrikDK
Member Posts: 14
Hey,
I have placed some code on the OnInsertRecord trigger on a page. This code checks if the date is already in the table and if it is, the current record is updated with the quantity of the new record and the new record is not inserted. The problem is that I can not see the record data from the Web Service. In the example below, the date variable is empty eventhough it is passed through to the insert trigger on the tabel with a real date. Is it not possible to work with the record data on the page? And if not, do you have an idea where I can place the code instead to prevent the new record from being created.
I hope it make sence and that someone can help.
/Henrik
I have placed some code on the OnInsertRecord trigger on a page. This code checks if the date is already in the table and if it is, the current record is updated with the quantity of the new record and the new record is not inserted. The problem is that I can not see the record data from the Web Service. In the example below, the date variable is empty eventhough it is passed through to the insert trigger on the tabel with a real date. Is it not possible to work with the record data on the page? And if not, do you have an idea where I can place the code instead to prevent the new record from being created.
lTabel.SETRANGE(lDate.Date,rec.Date); IF lTabel.FINDFIRST THEN BEGIN lTabel.Quantity += rec.Quantity; lTabel.MODIFY(TRUE); EXIT(FALSE); END ELSE EXIT(TRUE);
I hope it make sence and that someone can help.
/Henrik
0
Comments
-
AFAIK I can't answer your first question.
The if it is not possible clause I can answer:
In the case of a custom table:
You could make the date (or date + item no. although that's just guessing) your primary key.
Then there is no way that the record could be inserted.
Or you could place the code in your oninsert trigger of the table.
Or something else.
But I'm thinking that it might be a flawed solution altogether.0 -
Why don't you write your code on .Net? Something like:
TempPage_Binding tempSrv = new TempPage_Binding(); NAVConn.PrepTempBinding(ref tempSrv); TempPage tempPage = new TempPage(); List<TempPage_Filter> filterArray = new List<TempPage_Filter>(); TempPage_Filter dateFilter = new TempPage_Filter(); dateFilter.Field = TempPage_Fields.Posting_Date; dateFilter.Criteria = varDateFilter.ToString(); filterArray.Add(dateFilter); TempPage[] TempPage = tempSrv.ReadMultiple(filterArray.ToArray(), null, 0); if (TempPage.Length > 0) { TempPage[1].Quantity += varQty; tempSrv.Update(ref tempPage); } else { tempPage = new TempPage(); tempPage.Entry_No = pEntryNo; TempPage[1].QuantitySpecified = true; tempPage.Quantity = varQty; tempSrv.Create(ref tempPage); }
Ufuk Asci
Pargesoft0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions