Hi,
I had one Navision Native database with two companies. In contact table I want to select some records then after transfer this data to another company.
You can make a report from the contact table,
Setup record vars for instance : Companies linked to Comapny table, and ContactTable linked to Contact table
Then, you can add something like that (OnAfterGetRecord).
IF Companies.FIND('-') THEN REPEAT
ContactTable.CHANGECOMPANY(Companies.Name);
IF NOT ContactTable.GET("No.") THEN BEGIN
ContactTable.TRANSFERFIELDS("Contact");
ContactTable.INSERT;
END;
UNTIL Companies.NEXT = 0;
This is certainly not the best solution... it's quite old, probably not corresponding to the new Microsoft developpement rules.
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light
Thanks for ur replies. I dont want to copy all data. i want to use this functionality in contact card form. On tht form suppose one or more contacts will sent to another company. I put check box in table. checked contacts only transfer to another company. and also i will show wht are the companies exist in the database. If they select company1 then the checked data transfer to company1. suppose they select company2 then the data will transfer to company2.
Is this possible to show all companies in tht database in contact card????
If you want to have EXACTLY the same table data in all companies, it is possible to change a property in the table. If you choose DataPerCompany = No then the table will be exactly the same for all companies. It works fine in SQL.
The users will all have access to the same table. Carefull : if I remember well, you can change this property only if the table is empty.
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light
Is this possible to show all companies in tht database in contact card????
So see my first answer and apply the method to your form.
For instance, a new menu item "Transfer to other companies" and you can use a code similar to one I shown you. Try to do it, and if you have a problem or a question, then, ask.
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light
Hi philippegirod,
I wrote ur code in On Push trigger. But it has some problem. suppose i had 3 companies like A,B,C. I am in Company B. Now i want to copy some data from B to C. But in ur code it copies data from A. And also i want to copy data from B to C only not A. data will not copied on A.
Use this cute little tool to copy any field from any table between companies. This tool can by use in combination with Navision 3.70 (and higher).
New Functionality:
Possible to add a table ranges.
Add all fields of all tables using only one function.
Validate OnInsert Trigger.
Validate OnModify Trigger.
No field-exist-error when function "add all fields from this table" is used.
Shortcuts added and changed (for the better).
Number of records added to table list.
Number of records added to copy definition.
Table caption in table list added (non visible)
Field caption in field list added (non visible)
Access the copy setup form from the template list.
Ability to hit the copy command from template form.
Created, modified, skipped status after copy.
Created, modified, skipped status on copy progress window.
Overall progress bar on copy progress window.
Table relation per field (Non visible).
Commit after every table copy.
Skip copy record when both companies have the same number of records. To boost performance.
Log changes in standard Navision Changes log when tables included in setup.
Num of records in table.
Hi Savatage,
In ur code it copies total data and it is some complex. because we will open particular form and select table & fields then transfer. It is some lengthy.
Hi philippegirod,
I put your code in on push trigger. But data is not transfered. in our data base we have 3 companies like A,B,C. Now i want to copy company B to C(not all records only selected data). how can i do tht???
IF Companies.FIND('-') THEN REPEAT
ContactTable.CHANGECOMPANY(Companies.Name);
IF NOT ContactTable.GET("No.") THEN BEGIN
ContactTable.TRANSFERFIELDS("Contact");
ContactTable.INSERT;
END;
UNTIL Companies.NEXT = 0;
to show all companies in the database you have to design a form on table company (Object ID 2000000006).
For copying only special values from one company to another one just use the following code
LocObject linked to Table Object
"Filter ObjectID" Text[30]
LocObject.RESET();
LocObject.SETRANGE(Type, LocRecObject.Type::Table);
LocObject.SETFILTER(ID, "Filter ObjectID");
IF LocObject.FIND('-') THEN BEGIN
REPEAT
CopyTable(LocObject.ID);
UNTIL LocObject.NEXT = 0;
END;
The CopyTable function with the parameter ParObjectID [Integer]
local variables:
LocSourceTable RecordRef
LocTargetTable RecordRef
LocSourceField FieldRef
LocTargetField FieldRef
LocIntCounter Integer
LocIntRecordCounter Integer
LocSourceTable.OPEN(ParObjectId, FALSE, "From Company");
// here you have to insert your record selection
IF LocSourceTable.FIND('-') THEN BEGIN
LocIntRecordCounter := 0;
LocTargetTable.OPEN(ParObjectId, FALSE, "To Company");
REPEAT
LocIntRecordCounter += 1;
LocTargetTable.INIT();
FOR LocIntCounter := 1 TO LocSourceTable.FIELDCOUNT() DO BEGIN
LocSourceField := LocSourceTable.FIELDINDEX(LocIntCounter);
LocTargetField := LocTargetTable.FIELD(LocSourceField.NUMBER);
LocTargetField.VALUE(LocSourceField.VALUE);
END;
LocTargetTable.INSERT(FALSE);
UNTIL LocSourceTable.NEXT = 0;
END;
LocTargetTable.CLOSE();
LocSourceTable.CLOSE();
But i have a little problem with this code. While copying 3 GB of data the client shuts with the message "The window can't shut while the system is working".
Has anyone an idea to solve this problem?
hi Chris,
I want to use this functionality in contact card form. I had one data base with 2 companies.Suppose I created 2 contacts in Company A. now i want to sent to these 2 contacts to Company B. I put check box in table Contact. checked contacts only transfer to another company. In the Contact Card I put one Command Button. when I push the Button that record will transfer to another Company. In your code LocRecObject.Type.what is Type? which table can i link to LocRecObject.
Data will transfer to Company A to Company B as well as Company B to Company A.
Plz forgive my ignorance.
you have to link LocRecObject to the Table Object (Object ID 2000000001). This is the table which is behind the ObjectDesigner.
Type is the Object Type, it has the following values Table, TableData, Form, Report, Dataport, XMLPort, Codeunit, MenuSuite, System and FieldNumber
hi Chris,
Thanks for ur valuable help.I want help frm u about this functionality.
I want to use this functionality in contact card form. I had one data base with 2 companies.Suppose I created 2 contacts in Company A. now i want to sent to these 2 contacts to Company B. I put check box in table Contact. checked contacts only transfer to another company. In the Contact Card I put one Command Button. when I push the Button that record will transfer to another Company.
Data will transfer to Company A to Company B as well as Company B to Company A.
Plz forgive my ignorance. How can i contact u in e-mail.
Comments
Setup record vars for instance : Companies linked to Comapny table, and ContactTable linked to Contact table
Then, you can add something like that (OnAfterGetRecord).
This is certainly not the best solution... it's quite old, probably not corresponding to the new Microsoft developpement rules.
But oh my foes and oh my friends, it gives a lovely light
This only applies to 4.0 forward.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Is this possible to show all companies in tht database in contact card????
How can i do tht???
Thanks & regards,
kishore...
The users will all have access to the same table.
Carefull : if I remember well, you can change this property only if the table is empty.
But oh my foes and oh my friends, it gives a lovely light
I dont want to transfer all the data. I want to transfer only selected data in contact card.
So see my first answer and apply the method to your form.
For instance, a new menu item "Transfer to other companies" and you can use a code similar to one I shown you. Try to do it, and if you have a problem or a question, then, ask.
But oh my foes and oh my friends, it gives a lovely light
I wrote ur code in On Push trigger. But it has some problem. suppose i had 3 companies like A,B,C. I am in Company B. Now i want to copy some data from B to C. But in ur code it copies data from A. And also i want to copy data from B to C only not A. data will not copied on A.
Give me help....
Thanks & Regards,
kishore....
Company Copy v1.5
Use this cute little tool to copy any field from any table between companies. This tool can by use in combination with Navision 3.70 (and higher).
New Functionality:
Possible to add a table ranges. Add all fields of all tables using only one function. Validate OnInsert Trigger. Validate OnModify Trigger. No field-exist-error when function "add all fields from this table" is used. Shortcuts added and changed (for the better). Number of records added to table list. Number of records added to copy definition. Table caption in table list added (non visible) Field caption in field list added (non visible) Access the copy setup form from the template list. Ability to hit the copy command from template form. Created, modified, skipped status after copy. Created, modified, skipped status on copy progress window. Overall progress bar on copy progress window. Table relation per field (Non visible). Commit after every table copy. Skip copy record when both companies have the same number of records. To boost performance. Log changes in standard Navision Changes log when tables included in setup. Num of records in table.
http://www.mibuso.com/dlinfo.asp?FileID=275http://www.BiloBeauty.com
http://www.autismspeaks.org
In ur code it copies total data and it is some complex. because we will open particular form and select table & fields then transfer. It is some lengthy.
Please see the above post(I wrote already).
Thanks & Regards,
Kishore.
use this Link for transfer data to one company to nother company
I put your code in on push trigger. But data is not transfered. in our data base we have 3 companies like A,B,C. Now i want to copy company B to C(not all records only selected data). how can i do tht???
IF Companies.FIND('-') THEN REPEAT
ContactTable.CHANGECOMPANY(Companies.Name);
IF NOT ContactTable.GET("No.") THEN BEGIN
ContactTable.TRANSFERFIELDS("Contact");
ContactTable.INSERT;
END;
UNTIL Companies.NEXT = 0;
to show all companies in the database you have to design a form on table company (Object ID 2000000006).
For copying only special values from one company to another one just use the following code
LocObject linked to Table Object
"Filter ObjectID" Text[30]
The CopyTable function with the parameter ParObjectID [Integer]
local variables:
LocSourceTable RecordRef
LocTargetTable RecordRef
LocSourceField FieldRef
LocTargetField FieldRef
LocIntCounter Integer
LocIntRecordCounter Integer
But i have a little problem with this code. While copying 3 GB of data the client shuts with the message "The window can't shut while the system is working".
Has anyone an idea to solve this problem?
bye
Chris
I want to use this functionality in contact card form. I had one data base with 2 companies.Suppose I created 2 contacts in Company A. now i want to sent to these 2 contacts to Company B. I put check box in table Contact. checked contacts only transfer to another company. In the Contact Card I put one Command Button. when I push the Button that record will transfer to another Company. In your code LocRecObject.Type.what is Type? which table can i link to LocRecObject.
Data will transfer to Company A to Company B as well as Company B to Company A.
Plz forgive my ignorance.
Thanks & Regards,
Kishore...
you have to link LocRecObject to the Table Object (Object ID 2000000001). This is the table which is behind the ObjectDesigner.
Type is the Object Type, it has the following values Table, TableData, Form, Report, Dataport, XMLPort, Codeunit, MenuSuite, System and FieldNumber
Bye
Chris
Thanks for ur valuable help.I want help frm u about this functionality.
I want to use this functionality in contact card form. I had one data base with 2 companies.Suppose I created 2 contacts in Company A. now i want to sent to these 2 contacts to Company B. I put check box in table Contact. checked contacts only transfer to another company. In the Contact Card I put one Command Button. when I push the Button that record will transfer to another Company.
Data will transfer to Company A to Company B as well as Company B to Company A.
Plz forgive my ignorance. How can i contact u in e-mail.
Thanks & Regards,
Kishore...