Dynamic Temporary Table

doddwell
Member Posts: 65
Hello
I have a Codeunit that inserts some data into a table "myTable". I'd like the user to be able to see the data in Excel prior to the data being inserted - so I am planning to use a temporary table. I can write a "Preview" function but I am hoping I can amend the first function to either:
- dynamically control whether a record variable is temporary or not temporary
OR
- create 2 record variables ("recmyTable" not temporary, "recmyTableTemp" temporary) and another 3rd variable (not sure what type) and then assign "recmyTable" or "recmyTableTemp" to the 3rd variable.
Is this possible or should I write a second function?
Many Thanks.
I have a Codeunit that inserts some data into a table "myTable". I'd like the user to be able to see the data in Excel prior to the data being inserted - so I am planning to use a temporary table. I can write a "Preview" function but I am hoping I can amend the first function to either:
- dynamically control whether a record variable is temporary or not temporary
OR
- create 2 record variables ("recmyTable" not temporary, "recmyTableTemp" temporary) and another 3rd variable (not sure what type) and then assign "recmyTable" or "recmyTableTemp" to the 3rd variable.
Is this possible or should I write a second function?
Many Thanks.
0
Comments
-
I think I understand the situation but just to be clear, you have a function which essentially populates information into a table or tables in NAV. What you would like to do is have the user preview this data before NAV commits this to the database. I do not think that you need a temporary variable to accomplish what you require, here is a suggestion.
Before the function completes export the data to excel for the user to review, once exported provide the user with a confirm message so that the function process stops until the user answers the question.
1. If the user answers with a positive to continue the function then continue and the data will be saved to NAV.
2. If the user answers with a negative that the results are not correct or inappropriate, then provide the user with an error stating that this process has been user cancelled. The error message will rollback any data changes and the information will not be saved in NAV (this is assuming that a COMMIT has not been called during the processing of the function).Tim Whitaker | Senior NAV Consultant/Developer | The Software Workshop Ltd. | http://www.thesoftwareworkshop.com0 -
Hello Tim
Thanks for you suggestion - I hadn't considered that but can see how it will be a useful technique without having to do any more work. This particular module I'm writing will only have one user performing the processing at any one time so your suggestion might do the trick. Would you still approach it in the same way if multiple users are processing at the same time - I'm thinking about number series getting out of sync and table locking.
Thanks, Simon0 -
I would most likely approach this differently for multiple users, it would really depend on the type of transactions and where along the process you want to present the data to the user. Without knowing the specifics of the data being created and presented it is difficult to provide an exact answer, only suggestions on how to approach.Tim Whitaker | Senior NAV Consultant/Developer | The Software Workshop Ltd. | http://www.thesoftwareworkshop.com0
-
It doesn't matter who will run your process and how. You should always write your code with concurrency in mind. ERP systems are concurent.
That being said, you cannot start a process that writes to tables and shows a modal dialog before the transaction has completed (successfully or not). The system will not let you do that. In similar cases I always use temporary tables to collect the data, present it to the user and at the end transfer that data to the actual tables.0 -
doddwell wrote:I'd like the user to be able to see the data in Excel prior to the data being inserted - so I am planning to use a temporary table.doddwell wrote:- dynamically control whether a record variable is temporary or not temporarydoddwell wrote:- create 2 record variables ("recmyTable" not temporary, "recmyTableTemp" temporary) and another 3rd variable (not sure what type) and then assign "recmyTable" or "recmyTableTemp" to the 3rd variable.
I don't see, though, how these requests of yours pertain to the solution you are looking for.0
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