Variable with type record
mthe80
Member Posts: 27
Dear all,
I am sorry for not trying to look first about what will I ask to you guys.
Cause I rather run out of time.
I am rather confuse about this variable type.
Does this kind of variable has the same function as DATASET in VB.Net or C#? If I not mistaken, the dataset is think like a cache in our computer so when I do some changes, the changes only in my computer not to the database unless, I make it to insert to the database.
If I use that as a record of a table, does it will took all of the record?
When this kind of variable will take the record? Does it will take the record after I say Record.Setrange?
If I declare this kind of record without define it as a temporary, does the changes I made will also changes the record in the real table?
:-k
TIA
Michael Darmawan Teja
I am sorry for not trying to look first about what will I ask to you guys.
Cause I rather run out of time.
I am rather confuse about this variable type.
Does this kind of variable has the same function as DATASET in VB.Net or C#? If I not mistaken, the dataset is think like a cache in our computer so when I do some changes, the changes only in my computer not to the database unless, I make it to insert to the database.
If I use that as a record of a table, does it will took all of the record?
When this kind of variable will take the record? Does it will take the record after I say Record.Setrange?
If I declare this kind of record without define it as a temporary, does the changes I made will also changes the record in the real table?
:-k
TIA
Michael Darmawan Teja
0
Comments
-
I you don't make it temporary then changes are written into the table as soon as you use a command to write the values, like MODIFY, INSERT, DELETE or RENAME. If you don't use any of these commands, then no change will every be written to the database.
You can make a record variable temporary, but then it has no link to the database. So if you have a customer with number 123, and you do Customer.GET('123') with a temporary customer record variable, you will get an error message, even though the customer exists in the database.0 -
Well in general it is faster to search for it in the weekends. You're lucky someone is online.mthe80 wrote:Dear all,
I am sorry for not trying to look first about what will I ask to you guys.
Cause I rather run out of time.
A record is a 'storage' for 1 DB-record. When you get (FIND or GET) a record, it is stored in that variable. If you change it, it isn't changed in the DB until you do a MODIFY. If you have to change just 1 field in a record, you still have to get the record (GET,FIND), change the field (TheRecord."Field" := Value ; TheRecord.VALIDATE("Field",Value) ; and write record back (MODIFY). Until you do a MODIFY, the DB will not contain your new value.
SETRANGE,SETFILTER,SETCURRENTKEY does nothing to the values in the record. Only until you do FIND (or NEXT), the first (or a next) record will be put in the variable.
Temporary is like it says temporary. All changes you do on it will not be written in the DB. It exists only in the object where you declared it as a global (or a function in which you declared it as a local). When you enter in an object, a temptable will be empty (even if in the DB, there are records).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Continuing about the insert, modify, delete and rename think.
When I must use COMMIT?
From what I read, it say COMMIT is used when your write a trx (into a table?) and then you write terx again.
But IF the write trx only do it once in code, then the system will commit by it self.
So whenever i use
Repeat
(insert,modify,delete)
--> must COMMIT??
Until
or I don't have to use the COMMIT?0 -
Navision uses implicit transactions. A transaction is strarted by the first command that changes the database (insert,modify,delete,..) and ends (and commit database changes) when the calling objects completes without error.
An error will rollback the database to the point of last commit.
The COMMIT statement can be used to alter this behavior. This statement will commit any open transaction. Most of your Navision coding will not require the use of an explicit COMMIT statement.There are no bugs - only undocumented features.0 -
This depends on what you consider a transaction. If you want to commit each time you go through the loop, then you put the COMMIT inside the loop. If the loop encounters an error at some point, it will only rollback to the last COMMIT. If you consider the whole thing as one transaction, for instance when you loop through the sales lines for one shipment posting, then you can put a COMMIT statement right after the loop. You only have to do that though if something comes after the loop. If the loop is the last thing in your code, then just completing the code will commit the transaction to the database.mthe80 wrote:So whenever i use
Repeat
(insert,modify,delete)
--> must COMMIT??
Until
or I don't have to use the COMMIT?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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
