E9.2 How to set add limit to only one row in Headerless Detail (or more)


Hi guys, this is more about a tutorial than a question. I'm based in a recent problem I had and this discussion:
https://www.jdelist.com/community/threads/dont-display-a-blank-row-in-headerless.33064/ ("Don\'t Display a blank row in Headerless")

1) This is for you who wants a Headerless Detail that on UPDATE doesn't show the blank line.
2) And in ADD you want to prevent the user to enter more than one row. Here we don't want to show another blank line after editing the first one.

1) On Grid -> Grid Properties -> Options -> Enable "No Adds on Update Grid"
It will prevent showing the blank row used to add.

2) With the first step done, if you run the application, when you try to add (in my case with form interconnect) the form will show no lines because the blank line used to add has been disabled.
Now you can go to the Form ER -> Post Dialog is initialized ->

If SV Form_ Mode is equal to CO ADD_MODE
Insert Grid Row(FC Grid, <All Rows>)
End If

This new row is editable. If yours is not, check if in your Form Properties "Update on Grid Business View" is set and in Grid Properties "Update Mode" is set.

Despite of disabling "No Adds on Update Grid", the form still recognize the "ADD_MODE".
So we can set a manual insert to the desired table in Form ER -> Add Grid Rec to DB-Before
Remember to "Suppress Add" and use GC to populate your table.
Hello again. I wrote wrong above.

Although the form is recognized as "ADD_MODE", when we edit the line we insert, when pressing OK, the form does not consider the edit as "Add Grid Rec to DB-Before". It considers as update, so we go up to "Update Grid Rec to DB-Before". So the best to do is:

In "Update Grid Rec to DB-Before":

If SV Form_ Mode is equal to CO ADD_MODE
Suppress Update
GC -> table
BC Company (F55C0902)(CO) = GC Co
BC Occurrence Number (F55C0902)(55CNO) = GC Occurrence Number
BC Occurrence Status (F55C0902)(55CSTS) = GC Occurrence Status
End If