"In dynamics we have a Form Named "Form1" I created a button on it "Button1".
It will manage all the records related to the key in main form. There is dyna link created between the datasources. Only records of the currently selected main Key field will be shown. I need the selected KeyField value on the other form. How can I get it?"
So I wrote a small project to show the different possibilities.
In the project you will find 2 forms, 2 tables and a menuItem connecting the two forms.
3 ways of getting the current dynalink value are shown.
Here is a link to the xpo with the project:
download
Here is a screenshot of the result:
Forgot to give some explanations as well: :)
Basically, all the 3 form methods showing different ways of getting the dynalink value are called from the linkActive method in the second (slave) form.
This method is activated by the system every time a record in the parent form is changed, which allows for dynalinks to work. Great method :)
Excellent tutorial
ReplyDeletevery useful example! thank you!
ReplyDeletejust in case if somebody like me wants to clear Dynalinks between two forms I might suggest to add in Init() on DataSource of the second form after method Super() the following:
if (element.args() && element.args().record() && element.args().record().tableId == tableNum(YourTable1))
{
CurrentTable_ds.query().dataSourceNo(1).clearDynalinks();
}
Hi Vanya
ReplyDeleteI am using a class where I am packing a query inside a container and re-using it wherever needed, I need to preserve the base query for subsequent operations, but suddenly I encountered one of the scenarios where the base query had dynaLink, so I came to know that I cannot pack a query which contains DynaLink.
In my scenario ClearDynaLinks is not an option, I need to preserve the query and use it.
Please help ....
Shekhar
manthacs@hotmail.com
Hi Vanya
ReplyDeleteI am using a class where I am packing a query inside a container and re-using it wherever needed, I need to preserve the base query for subsequent operations, but suddenly I encountered one of the scenarios where the base query had dynaLink, so I came to know that I cannot pack a query which contains DynaLink.
In my scenario ClearDynaLinks is not an option, I need to preserve the query and use it.
Please help ....
Shekhar
chandrashekharmantha@gmail.com