Has anyone encountered this where the related information looks up the wrong line number from the sub page? I have a conditional statement which decides what will show depending on the status of the header but the information is picked up for the wrong line. I have everything set correctly in code so that the header calls the function on the sub page and then it is filtered on the line no.. However i can see by the filters on the page called that it hasn't looked up the correct line no. Any help would be appreciated. This is on 2009 R2.
0
Comments
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
This does not work, because RTC is not designed for it. If you call a function on the subpage it will always work with the first line, not the one you selected.
You need to add the action on the subpage and call it from there.
Although, there is a workaround, but it does not work perfectly: You can assign a keyboard shortcut to the action on the subpage und on the action of the header page you use send keys to simulate the keystrokes. The limitation is that you need to set the focus to the lines before you press the header action button, otherwise it does nothing.
CurrPage.RunShiftLines.FORM.ShiftDetails; //this is what i call from the related information
//this is the code i have in the shift details function on the sub page
IF Status IN [1..5] THEN BEGIN
RunShift.RESET;
RunShift.SETCURRENTKEY("No.",Line No.");
RunShift.SETRANGE("No.","Document No.");
RunShift.SETRANGE("Line No.","Line No.");
FORM.RUN(0,RunShift);
END ELSE BEGIN
RunShiftJournal.SetShiftRec(Rec);
RunShiftJournal.RUNMODAL;
CLEAR(RunShiftJournal);
END;
Refactor your solution to place the action on the subform itself, or use the Send Keys workaround.
But here is how you do it:
Assign a shortcut to the action in the subpage (eg: Alt+4)
Then in the OnPush Trigger of the Header Action use this Code:
Where WSHSHell is an automation of type: 'Windows Script Host Object Model'.WshShell
You can find a reference to SendKeys here: http://msdn.microsoft.com/de-de/library/system.windows.forms.sendkeys%28v=vs.80%29.aspx