Insert 1 reg in a Tabular Form

AlkroAlkro Member Posts: 115
I have a tabular Form.

I wan't user only can input one line and not allowed put another line. Only One. Then, user click to register and the line will dissapear...

Are there any propierty in Form or SourceTable...? Maybe C/AL Code?

Answers

  • kinekine Member Posts: 12,562
    May be better is to add just editboxes based on variables, let user to fill the data, and after you press the button, the variables are saved into table. In this way you have whole process under control.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • AlkroAlkro Member Posts: 115
    Excuse me, i don't explained very well...

    I have a Form, in this Form there are 2 SubForms, Subform1 is linked to a table and i want that user can input only 1 line.

    I dont understand that you say with "editbox"...
  • garakgarak Member Posts: 3,263
    edited 2008-05-15
    why, and what is, if the user insert one line, close the form, can he now insert a second line if he reopend the form:?: If no, you can make a error message in OnInsert Trigger of the table (or directly in Subform), if there still exist a record for record in Main form -> Error(Blablabla);

    regards
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Alkro wrote:
    I have a tabular Form.

    I wan't user only can input one line and not allowed put another line. Only One. Then, user click to register and the line will dissapear...

    Are there any propierty in Form or SourceTable...? Maybe C/AL Code?

    Why?
    David Singleton
  • apertierraapertierra Member Posts: 61
    Sure... modify the subform to use the integer table instead of whatever table is using right now.
    Modify also the subform so it keeps a temporary set of records on it, displaying them instead of displaying the integer field (modifying the functions so it reads accordingly the records). Modify it to allow one extra record, if the user enters the record and clicks on the register function, post that line into the table and the limit will increase again by one....

    If that's too complicated for you, then just make the subform1 to be non-insert allowed, add a few "text box" on the top of it so you can add values for new lines and the button to "register" so the line goes into the lines as a new record.
  • AlkroAlkro Member Posts: 115
    I solved in "OnNewRecord" in Subform, searching if exist a record in the table, if exists an error message appear.

    Another question:

    In other subform, where user can put many lines, this subform is sourcing another table. I want user put a decimal number in a field and refresh a field in principal subform.

    Imagine in a shop:

    User fill one line for one product. A price field.

    Line1: Price 5.00
    Line2: Price 10.00


    In Principal Form exist a field. Total price.

    When user put price 5 in line, Total price in Principal FOrm refresh to 5.
    When user put line with 10, principal form refresh (automatically) to 15 (5 + 10).

    I try in OnValidate of price in Subform, but Total price in principal form is not refresh automatically...
Sign In or Register to comment.