virtual table ?

Hi, I have been reading an answer to a question and in the answer they talked about a virtual table. Can anybody tell me what a virtual table actually is and how do i use a virtual table[?] thx, Wendy

Hi Wendy, I’m assuming that you are refering to Temporary tables. Below is an extract from the development manual. What is a Temporary Table? A Temporary Table is created by C/SIDE when a record variable is created that has its temporary property set to yes. It is created with the same exact structure of the real table that is in the subtype property of the record variable. It is, however, completely empty (no data). This can be used as a temporary workspace to insert records, manipulate them and then either put them into a real table or allow them to disappear. No data in a Temporary Table will ever be stored on the server. To save records that are in a Temporary Table to the server, you must copy them to another record variable that is not tied to a temporary table. Example of Using a Temporary Table The following code uses two record variables. Customer is a regular record variable that points to the real customer table. CustTemp is a record variable that points to a temporary copy of the customer table. Both have their subtype set to Customer, but CustTemp also has its Temporary property set to Yes. You can type in this code to see what it does. Customer.FIND(’-’); REPEAT IF Customer.Name > ‘F’ THEN BEGIN CustTemp := Customer; CustTemp.INSERT; END; UNTIL Customer.NEXT = 0; FORM.RUN(FORM::“Customer List”, CustTemp);

Hi Bruno, There is such a thing as virtual tables too: date, integer … So Wendy which one you were asking about (or did we just confuse matters even more? ) Cristi

Hi, Bruno, thanks for the information but i do know about a temporary table.What i don’t know if when they talk about a virtual table do they mean a temporary table or is there such a thing as a virtual table which you can assign any table to in the code. Cristian, are there more virtual tables or are date,integer the only two. Wendy

Hi Wendy, virtual Tables are not shown in the Objectdesigner, but if you design for example a form, declare a new global variable of type record and press in the subtype-field F6 you get a list of all tables in the System, including the virtual ones. In the Range begining with 20000000000 you see the virual tables. Choose one of them and in the Symbol-Menu (F5) you can see which fields are in this virtual Table. Hope this helps. Greetings, Frank

Hi Frank, This is very helpfull but one more question. Can i write in the virtual table and if i write in it will this be written to the database or does they work exactly the same as a temporary table. Wendy,

Hi Wendy, Yes, you can write to virtual tables and the written data is in the Database. If you want a virtual table as a temporary table, you have to declare the global as a temporary variable. I’m not quite sure if you can write to all virtual tables. I use them mostly for getting Information [:D] There are some tips and tricks regarding to some virtual tables, for example the virtual table “file”. Please search this forum and you will get many more information about this. Greetings, Frank

hi You cannot write to a Virtual Table. Virtual Table and Temporary tables are totally two different things. Virtual tables are generated by Navision at runtime and cannot be modified by the user, only the information contained in it can be viewed. One example of virtual table is the date table, u cannot write to it. Where as the temprary table is a used while decalaring a variable of type record. When a record variable is defined as temporary, it gets the data of the corresponding table. Here the user can do what ever he likes with the data in the temporary record variable, but these changes will not be updated in the database. With Regards Hari

Hi Hari, That’s not right. You can write to some virtual tables, not to all! What about the table “field”? There you can INSERT,MODIFY and DELETE records by code. Greetings, Frank

If unsure regarding your table of choice, check “RecOfYours.WRITEPERMISSION()” which will tell u for sure… /LG

hi Frank you are right, why it does’t came to my mind while writing the reply [xx(], Thanks for the comment Hari

Akash/ Frank,

Is there any sample tables/ forms/ codeunit other than report that we can reference how a virtual table(s) works?

Codeunit 359,5847,7130,7380 and etc

They are also covered in the development training material.

mohana/ denster,

thank you very much!

@ mohana,

i can’t verify as i am not the post starter.