Is there a way to quick paint an on-line update screen that would show multiple DB records on a single screen (ala hr02 or pr15)? It seems like this should be possible (since so many screens in Lawson are similar to these) yet I have never been able to find any good instructions on how it is done. If anyone could point me to a Lawson guide or KB article that explains this, I would be very appreciative. Thanks.
There is definitely a way. :)
Its kinda tricky as you have to hit the HOME and END key to select your region and what not. But basically you want to look into Header Details. I don't have the time today but I'll see if I can put together a tutorial in word for you by next week. Although I have a feeling Milo is going to beat me to it :D
TheKing75:
[This is only for UNIX/Windows, using the LID interface, Apps/Env 8.0.3/8.0.3; if may work differently for other Apps/Env combinations. If you have an IBM system which uses RPG, or if you're trying to do this in Design Studio, sorry, it does not apply.] [Extract from "Lawson 4GL for Dummies", copyright © 2007 by Olim Fforkust.]
The key to getting a working QuickPaint that can update multiple records is the Header/Detail relationship. It's going to be the Detail file that you can do multiple records on. So when you have picked your file, you have to pick a correct corresponding file that gives you a many-to-one relationship. That other file will be your "Header" record.
Now for an example. Say we want to update Customer information in AR, multiple records at once. We want to adjust the Customer Status for a lot of customers at once.
Here's what we'll do. We start with the DBDOC info on Customer.
> dbdoc -n ProductLine AR ARCUSTOMER | lashow
Go down to ARCUSTOMER FILE RELATIONS. Look in ONE TO ONE RELATIONS. We've got a bunch of them, but the best one looks like relation Arcomp - where the field COMPANY is the link.
* LAWSON FUNKINESS * This is the Many-to-One relation that we wanted, however since we're seeing it from the other end, it's technically a One-to-One relation.
Going up to the ARCUSTOMER FILE INDEX section, index ACMSET1 is COMPANY + CUSTOMER. So it looks like the Header file would best be ACO, which is file ARCOMP.
We set up our new Screen Paint in AR, so that we can get to ARCOMP. (Make certain that you change Program Type from Online Inquiry to Online Update -- yep, I didn't do that once, I got a strange screenpaint!) When we go in to start your Screen Paint, we get a screenful (and more) of Primary Files. Select ARCOMP. Notice that when we have navigated down to ARCOMP, one of the highlighted files is ARCUSTOMER. Ah, that's what we want!
Pressing *Enter* selects ARCOMP. Now we see ARCOMP and a bunch of other related files on top, in the Database Structure section, but only ARCOMP on the bottom, in the Program Structure section. We want to select ARCUSTOMERS as our Detail file. Hit F6 "Define" then select "B. Detail". At the bottom of the screen, it says, "Select Primary Related Otm File". In the top section of the screen, one of the related files becomes highlighted. Now we can navigate (using the right- and left-arrow keys) until we get to ARCUSTOMERS. Then we press *Enter*. Bingo - ARCUSTOMERS appears in the lower Program Structure section, below ARCOMP.
* LAWSON FUNKINESS * The file is ARCUSTOMER, but in this screen, it shows up as "Arcustomers". Where the final "S" comes from, I don't know.
We go in to paint the screen - but we don't use QuickPaint as it will not work. Instead we use F8 "Action" and select "A. Paint". We put the key information on the top of the form -- in this case, Company, since that's the link in the ONE TO ONE RELATION. We place the field on there with F2 "Input" in the usual way.
Now we have to create a Detail area. Move the cursor down a bit on the screen. Hit F6 "Define", select "D. Detail", then select "A. Enable". The bottom of the screen asks you "Please Mark/Bound A Form Detail Region". We will be selecting a series of lines, so it doesn't matter what column the cursor is on. We bring the cursor to the line we want to start our Detail area on, then Hit *Home*. We move the cursor down to the line we want to end the detail section on, then hit *End*. We see a vertical bar on the left, showing where the Detail area is going to be.
* LAWSON FUNKINESS * Now we have to this all over again, but the results will be different. Hit F6 "Detail" again and select "A. Enable" again. The screen changes -- the bar on the left goes away, and where the very first line was, a single "X" appears. This is going to be our "A/C/D" box, so we leave it alone. We have to build our Detail area on this one line.
To build our example quickly, we'll put in the least fields we can get away with. First we have to put in CUSTOMER, because that's the second field in the index ACMSET1. (We already have COMPANY in the Header section.) Move the cursor to the right a little bit. Now hit F2 "Input". Notice that the fields listed are from ARCUSTOMER, not ARCOMPANY! Ah hah, that's what we want! Highlight CUSTOMER and hit *Enter*.
To add the description, we cursor-right a few columns and use F3 "Output" to put the SEARCH-NAME field on the line. Then we cursor-right a few more columns and use F2 "Input" to put the ACTIVE-STATUS field on the line.
Now to finish this up. Hit F6 "Define", select "D. Detail" and select "B. Set". The Detail area is populated. Now press *Enter* twice to save the form.
* WARNING * After you use "Define" - "Detail" - "Set" you can't delete fields already entered in the Detail area. You can add fields, but you can't delete any.
Honestly, I never stop there, I always generate the COBOL and go in and edit the source code. But this gets us to the point where the program's basically built, and all that's left is tweaking.
I hope that this helps. :coffee:
That is Fantastic! Thanks a million!!! :werd: