Options

Value of control in subform on mainform

SnoTSnoT Member Posts: 2
edited 2004-06-06 in Navision Financials
Hello,

I have a mainform with two subforms. (SubF1 and SubF2)
Both subforms are based on the same object and have a control called Ref.
On the mainform, I'd like to create a third subform that holds a filtered table, based on the two first subforms.

As a first step, I thought to do this by creating a variable that contains the necessary filter. (like = SubF1.Ref|SubF2.Ref ) but already there, I have problems to generate this value.

My question, though, is probably rather sipmle to answer : can I read information in a control on a subform towards a control on a mainform ?

Tnx in advance !
kinda like this site !

Comments

  • Options
    RobertMoRobertMo Member Posts: 484
    define a function on subforms's form that returns the value of your variable:
    PROCEDURE GetMyValue@1() : Integer;
    BEGIN
       EXIT(MySubFormsGlobalToPassToMainForm);
    END;
    
    Then you can call this function from main form using:
    ValueFromSF1 := CurrForm.SubF1.FORM.GetMyValue;
    ValueFromSF2 := CurrForm.SubF2.FORM.GetMyValue;
    

    You can return only simple variable types.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Options
    RobertMoRobertMo Member Posts: 484
    If you want to return a complex variable types (like records) then you should change your function:
    define a function on subforms's form that has a parameter called by reference. you don't need to use the return var.
    PROCEDURE GetMyRec@1(VAR MyRecToPass 36);
    BEGIN
       MyRecToPass := SubFormsRecToPass;
    END;
    
    Then you can call this function from main form using:
    CurrForm.SubF1.FORM.GetMyRec(PassedRec1);
    CurrForm.SubF2.FORM.GetMyRec(PassedRec2);
    
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.