Options

Choosing diff. forms from 1 button & displaying right da

zzz458zzz458 Member Posts: 11
Hi,
One of our customers have different product group codes and different properties for each group.
I have created different tables and forms for each product group to keep the properties of the items belonging to that group.
Now I want to place a button into the item card which will understand the group of the product and choose the necessary form and
then show the properties of that item. I have already done the first part. The button chooses the right form according to product group code but I can't make it display the datas of that item.
Can this be done? If yes, how?
Thanks a lot.

Comments

  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    If you have your form as a variable, you could do something like:
    SomeRec.SETRANGE(.....);
    aForm.SETTABLEVIEW(SomeRec);
    aForm.SETRECORD(SomeRec);
    aForm.RUN;
    
    Or, if you have olny the id of the form:
    SomeRec.SETRANGE(.....);
    FORM.RUN(4711,SomeRec); 
    
    where SomeRec is a record variable that holds the properties of the specific group.
  • Options
    DenSterDenSter Member Posts: 8,304
    A suggestion:

    Add a field to your product group table that links to the object table, and give the user the ability to enter the form number there. That way you can use the number in that field to know what form to open.
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Arhontis wrote:
    FORM.RUN(4711,SomeRec);
    Try to avoid this.
    Always use
    FORM.RUN(FORM:"My Form",SomeRec);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I agree with Alain.

    For Lazy Programmers (Like me):

    If you compile

    Form.runmodal(form::form1)
    
    

    It will generate
    Form.runmodal(form::"Company Information")  
    
    Same goes for reports and dataports etc. :D
  • Options
    krikikriki Member, Moderator Posts: 9,090
    For even more Lazy :-$ Programmers (Like me who copied the text from Mark):
    If you compile
    Form.runmodal(form::"1")
    
    It will generate
    Form.runmodal(form::"Company Information")
    
    Same goes for reports and dataports etc. :D:D:D
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Same goes for optionstrings
    SalesLine.Type := SalesLine.Type::"2";
    

    Makes
    SalesLine.Type := SalesLine.Type::Item;
    
    

    After compiling

    I will post this to Tips and Tricks
Sign In or Register to comment.