two forms in one program

Sort:
You are not authorized to post a reply.
Author
Messages
Rita
Basic Member
Posts: 15
Basic Member
    Is it possible to paint two forms (ie the key information entry small form xx99.1, and then the full header/detail form xx99.2) in the same program? Or is my only option to create two different programs via painting and then merge them together?
    Woozy
    Veteran Member
    Posts: 709
    Veteran Member
      Hi Rita,

      This should be possible. Subforms are really completely separate programs, even though they have the same program number.

      I often create subforms as separate programs initially, so I can generate code without wiping out the other programs. After I get the form working as I expect, then I do a find/replace within the source code to update the temporary program and form references with the final ones and then paste the new code into the source for the existing program and recompile. This needs to be done in the PD, .scr, .rpt, and WS. The Working Storage items will be shared, but it isn't difficult to separate the data items for the separate forms, if that matters to you.

      If you examine the source for a program that has multiple forms, you will see where the code for each form begins and ends. You just need to duplicate that in your custom program.

      Good Luck.
      Kelly Meade
      J. R. Simplot Company
      Boise, ID
      Woozy
      Veteran Member
      Posts: 709
      Veteran Member
        I should have mentioned, if you want to add a second form to the program for painting, you can do by pgmdef>>program>>F6-Define>>C-Paint>>F6-Define>>A-Form and selecting a primary table.

        However, if you go this route, you will have to generate code for the entire program, rather than just your new form. If you have any custom code in the existing forms, it will be wiped out.

        I almost always have to add (a lot of) custom code, which is why I take the "create separately and merge" approach.
        Kelly Meade
        J. R. Simplot Company
        Boise, ID
        Rita
        Basic Member
        Posts: 15
        Basic Member
          thank you, so if I understand you correctly, the best course of action would be to create one program with header/detail screen and with all custom stuff. Once its working, I would just create a small program with the initial key/header and merge them together.

          One more question: I have a form with inputs fields which are mostly from primary file, but I need to add a few also as input fields that come from secondary file. Am I right in assuming I should paint them as output and them "custom" change them to input fields. Or is there another way to do it?

          Wishing I had access to the Lawson developer's tutorial, and a manual with comprehensive instructions.
            
          Woozy
          Veteran Member
          Posts: 709
          Veteran Member
            If you are working for a Lawson customer, you should be able to download the developer guides from the knowledge garden. I'd recommend that you download "Application Development Workbench" and "Application Development Workbench Standards" for your LSF version to start with. The latter has been most helpful to me. You could probably submit a support ticket requesting these documents as well.

            I'm not sure what you mean by a "small program". I treat each form as a separate application. I paint what I can and generate, then modify the code, then compile and test. Once both (or all) programs are working exactly as I want them to, I manually lump the code together under one program code with separate forms. There really isn't any shortcut.

            Regarding fields from secondary tables, as long as the primary table has a relationship to the secondary table (defined by the application, not the database), you should be able to paint the secondary fields just as you can primary fields - input/output/whatever. When you are selecting the primary table in pgmdef, it will show you the related tables via highlighting. The application treats the combined data as a view, so all the fields from both (all) tables should be available (depending on table relationships and security rules).
            Kelly Meade
            J. R. Simplot Company
            Boise, ID
            You are not authorized to post a reply.