Get Max Grid Rows

Axel

Member
Hi List,

i have a problem with the system function "Get Max Grid Rows".
i use this function to loop through all lines in a grid and set a default value in a row for each line. this seems to work fine as long as i do not have more lines in the grid as they could be seen on the screen.
for example: the grid contains 25 lines. if i have a screen resolution 1024x768 i can see aprox. 20 lines and the "GetMaxGridRows" returns 25 but if i change now the res to 800x600 the systemfunction returns for the same grid only 15.
if i go to the bottom of the grid, the grid fetches all lines and after that the value is again 25.
any ideas how to solve this problem

thanks
Axel

XE on AS400 SP16, CO on AS400, Citrix Clients
 
Axel,

Try turning on the grid option "Disable Page at a time Processing".

By default when a grid loads it loads the number of rows that can be displayed plus a few more. This is to prevent long grid loading times when there is a lot of data.

Disabling page at a time processing means the grid will load will rows, possibly delaying displaying the screen because of the amount of data that needs to be loaded.

XE - SP15.1 - Update 2
Oracle 8.1.6
Sun Solaris 8
 
Thanks,

that's it....you solved my problem ;-)

Axel

XE on AS400 SP16, CO on AS400, Citrix Clients
 
Hi Axel,

Trevor's hint is right but if you have a lot of records then disabling the "Page at a Time" processing has performance disadvantage as well for the user who runs the application as well for concurrent users and running UBEs.

If your logic enables, you can place your default setting into the Write Grid Line-Before event (Form Event)instead of disabling the "Page at a Time" processing. In this case you do not have to construct a while loop using Get Max Grid Row and Get Grid Row system functions, further you can spare the two row counter variables also, so this is simpler solution and hasn't performance disadvantage.

If you are not sure, that this solution can work for you then please let us know more about your current situation, e.g.:

1.) What is the type of your Form?
2.) What kind of information required to generate default value? E.g. is all information available when a record fetched from the DB?
3.) Do you want to re-run your logic after the grid has been populated? E.g. when something changed on the header part of the form?
4.) Do you want to set default value for all record or just which appear in the grid?

Please, let us know could it work for you or not. Thanks.

Regards,
Zoltán


B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Hi Zoltan, (re:(post#22476/re:22452))

I realize that this reply is from a long time post but I just came across the same problem and I was wondering if you could explain further the alternative to disabling the "Page-at-a-time" option. I am trying to create an app similiar to "P0911Z1" but want to display the number and total amount records that have been retrieved. I have tried disabling the page-at-a-time option and you are right when you wrote that that could affect performance. This is just a test app that I am trying to create so no rush on this one. Oh yeah, this is my first post to the list.

Thanks,
Ted
 
Hi Ted,

First, welcome to the JDEList Forums!

I hope, you won't forget to attach your system configuration informations nex times to your posts.

I checked P0911Z1 on our XE and it has 3 forms. I am not sure want you want to do exeactly. I suppose you do not want to insert all rows from the Business View and want to insert Total rows, am I right?

Let's see:

1.) You can issue a SuppressGridLine system function call (Grid category) in the GridRecord in the GridRecordIsfetched form event when you do not want the record to be inserted into the grid. Of course, you can accumulate its values to your totals.

2.) If you have only one level totaling then accumulate your total in the grid buffer (GB prefixed elements in the ER). You can use the ClearGridBuffer and and InsertGridBufferRow system function (both are in Grid category). With the first you can initialize the totals, with the second you can insert it into the grid at the right place.

3.) If you have more level of totaling then you can create ER variables (the best to choose Form scope for later flexibility of coding) to store the totals on the different levels. When you encounters a point when you have to insert the total then move the valuse from the variables to the GridBuffer and InsertGridBufferRow.

An other solution can be to use a "dummy" business view and suppress all automatical fetches: use SuppressFind system function (General category) and set the Options appropriatly on the Properties window of he Form. Code your own logic to fetch the records and populating the grid in the ButtonClicked event of the Find button. If you want an automatical Find on entry then you can issue a PressButton(HC Find) in the PostDialogIsInitialized event.

An other hint is that you can set different font and colour for your total rows (e.g. including diffent for each level too).

Coding totaling, mainly multi level totaling has several tricks and traps. Here are some for you:

1.) Creating a logic to detect the first level breaks.
2.) How to detect level breaks.
3.) Higher level breaks have to trigger all lower level breaks starting from the lowest.
4.) Managing the totals after the last row has been fetched.
5.) Minimizing the code placing the different level of break logic into the ButtonPressed event of different hidden buttons simulating something "subroutine" and each level triggers only the immediattely lowest level.
6.) Disableing the QBE lines to disable for the users to change the sequence on the grid which generally cause malfunction of the logic (level breaks are tightly tied to a supposed sequence of the records).
7.) etc.

Hope, could be a bit of help for you.

Good luck,

Zoltán

P.S.: What kind of form do you have to use? Do you want Update/Delete/Add capabilities (or some of them) on your form?

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Hi Zoltán,

Thanks for the reply, haven't tried it yet though. I'll keep you posted.

Ted
JDE OneWorld B733, SP16.1
 
Back
Top