Defaults Values on Grid

TimPierce

Reputable Poster
I'm trying to default some values onto a Grid. The user will enter the values on the Header of a Headerless Detail form and these values will default onto each new Grid Line that appears on the grid ........at least in theory!!

I put the code onto the Row Is Entered event but it seems this event is only fired the 2nd time the row is entered?!?

There is a default value override on each column but I don't think allows the entry of variables.

Anyone have any ideas?

Thanks.
 
Hi,

No I haven't tried that because the defaults are used along with certain user entered fields to calculate other values on the grid. So the defaults would have to be there right at the point the user first enters the grid row.

Thanks for your help,

Tim.
 
Hi Tim,

Do you want to default the fields only for the newly added grid lines or you want to work it for all, alredy existing lines too?

Do you calculate the default value based on values in more lines in the grid? If yes, maybe there is the problem. How do yo do that?

Two cents:
General rule of thumb: try to debug the application to figure out why doesn't works.

Please, share with us some more information, making easier too help you.

Regards,

Zoltán
 
Hi Zoltan,

I only want to default the values for new grid rows, existing rows are to remain as they were.

The default values are free entry fields contained in the header at the top of the screen. The plan is to default these values into certain fields on each row, the user also populates other fields on the row and then a series of calculations take place to populate some further fields on the row.

Basically what I am doing is customising a copy of the P4210 to create a new, improved Quote Entry tool, I have changed the Detail Revisions screen (W4210A) to contain a number of calculated fields such as Allowance %age, Sales Margin, Discount, etc etc. I just want to allow the users to enter, say, a Margin %age value at the top of the screen and then for this value to be automatically copied onto every new line the user clicks onto, and so this Margin can then be included in the various formulae that are applied when the user enters cost and price values.

Hope that makes some kind of sense! Cheers,

Tim.

PS - I have debugged it, that's how I discovered the Row Is Entered event is only firing second time around. Very strange.
 
Hi Tim,

Thanks for the additional information.

Next tip: try to place your logic under the "Add Last Entry Row to the Grid" grid event and please, let us know that does it work as you wish or not.

Here is some information extracted from the help of "Add Last Entry Row to the Grid" grid event:
>>>>>>>>>>>>>
Typical Usage

Use this event to assign line numbers and default values for new lines in Add and Update modes.
<<<<<<<<<<<<<

Good luck,

Zoltán
 
Excellent, good solution. Thanks!

It works now for every row except the first, because obviously the first blank row appears on the grid at startup before the user has entered the defaults - all subsequent rows now have the defaults.

Tim.
 
Aha, I've got it. If I put the code on Set Focus On Grid it will populate the first row.

Thanks for your help Zoltan. The users are gonna love this baby!
 
Hi Tim,

Glad to read about your success!

Just an other idea:
You can provide the first row with default value in the Control Exited and Changed event of your control on the header part, previously using the GetGridRow sys function, selecting the first row. It was just a minor hint.

Regards,

Zoltán
 
Back
Top