Problem with RunFormLink...

j.stalderj.stalder Member Posts: 35
Hi all :D

Everything is about the Production Order, Routing, ... but it could be the same with other table

I have a form (Form1 --> F99000831, ) and a subform (Form2 --> F99000832)

When I change the record in Form1, the records in Form2 change according to Form1.

From Form2 I can display the Routings (Form3 open with run) of the selected record in Form2. But the problem is that the Record in Form3 don't change when I change the record in Form2. This what I'd try to do...

Form1
¦
Form2 --> Form3

I created a button in Form2 that open Form3 and by using RunForm (Link,View,LinkType) it must do it. There it is the problem... I set all the parameters RunForm (created the link between Form2 and 3 with RunFormLink)...

The compilation is ok but when I run the Form1 and I click on the button in Form2, I get a error dialog that the type in RunFormLink are not the same. I think here there could be a "bug" because the program take the fields from Form1 and not from Form2 to do the link with Form3 (anyway I don't have the choice when i create the RunFormLink, i must choose fields from table of Form2 and 3...)

I think the program doesn't understand where the button is located, the button is in Form2 but the program think it is in Form1

Can someone help me, understand me

Or does someone has an another idea to update the records in Form3

Thanks

Joachim

Comments

  • krikikriki Member, Moderator Posts: 9,118
    If I understood correctly, you have a subform in another subform.
    This is not possible with the standard properties, you have to write code in the "OnAfterGetCurrentRecord" of the first form and the second form. The code serves to call a function in second form (or third form) that changes the filters and then do an update to show the records in the new filter.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • j.stalderj.stalder Member Posts: 35
    Hi,

    No i don't have a subform in a subform, it's just a form that is opened by the subform with run and must be updated when the record in the subform change...

    Joachim
  • DenSterDenSter Member Posts: 8,307
    Set the RunFormLinkType property of your button command to OnUpdate.
  • j.stalderj.stalder Member Posts: 35
    Hi,

    Thanks but I did it :wink:

    In fact it's working but only with two fields and i need to have tree fields to be enough accurate (to have the right records filtered in Form3) otherwise I have too many

    As I've seen the 2 first field are the same (same number, same type) in the tree table of the 3 forms (Form 1,2,3). But the last one, is the same in the table of Form2 and 3 (it's because it works with 2 fields) but different in the table of Form1... and the program mix at the execution between 3rd field of Form2 with 3rd field of Form1 perhaps because the the Form2 is a subform of Form1 :?:

    If you want to see, it is in the Table 5405 (Form1), 5406(Form2), 5409(Form3), the first 3 fields of each table... (Production Header, Line, Routing Line)

    Joachim ](*,)
  • krikikriki Member, Moderator Posts: 9,118
    I see 2 possibilities:
    1) in the button to open form 3, use a global variable to that form
    in the OnAfterGetCurrentRecord, send current record of form 2 into form 3 (a new function in form 3 that changes the filters and does a Currform.UPDATE) with the help of the global variable.

    2) use a single-instance codeunit with 2 functions, 1 that receives a record from form 2 and one that returns the record from form 2.
    Form 2 : OnAfterGetCurrentRecord => send the record in the codeunit
    Form 3 : "Form - OnTimer()" : get the record (if any) from the codeunit, change the filters and do a Currform.UPDATE.
    This last possibility will have some delay in updating the data.

    I didn't try out neither, but these I would try if the question came.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • j.stalderj.stalder Member Posts: 35
    I'll have a look at your idea, i'll let you know in this post

    Thanks

    Joachim
Sign In or Register to comment.