Clear All fields in a form

mustafaAlsoufi
Member Posts: 66
Hello,
I'm sorry if this question has already been asked before but I couldn't manage to find an answer to it.
a form has been created with a couple of fields, checks marks, and an "Add" button which will add all these fields into a table. My question is I want once that button is pressed all these fields in the form cleared and ready to be filled with other values so it could be added into the table as well
Thanks in advance.
I'm sorry if this question has already been asked before but I couldn't manage to find an answer to it.
a form has been created with a couple of fields, checks marks, and an "Add" button which will add all these fields into a table. My question is I want once that button is pressed all these fields in the form cleared and ready to be filled with other values so it could be added into the table as well
Thanks in advance.
0
Best Answer
-
- What is the reason to use other table tu manual input data?
- Why do you want to delete data from input table after transferring them into "right" table?
If exists valuable reason to do it this way, my recommendations:
- use same fields and field numbers in working table and then use TRANSFERFIELDS command
- use CLEAR(Rec) to empty fields in working table after transferring fields into UserRec table
- Use messages if GUIALLOWED to make function ready to use in background scenarios
5
Answers
-
- your description seems to used global variables instead of table fields. Why? With table fields no Add button needed
- clearing all global variables must be done by code behind the Add button0 -
Thank you for your reply.
I'm not using global variables, The only global variable is a Rec variable to access the table. what I'm doing is
Table.field := field; to insert what the user is filling the fields with in the form into the table.
once the user insert these fields into the table using the "Add" button, I need all these fields in the form to be cleared so the user can add another line into the table with different values into these fields
The following code is the code behind the "Add button"
UserRec.RESET;
UserRec.SETRANGE("Trade Partner No.", "EDI Document No.",Code);
// If the record already in the table then the following message should appear without inserting a new //line
IF (UserRec.FIND('=')) THEN
MESSAGE('The record already exists') ELSE BEGIN
UserRec.INIT;
UserRec."Trade Partner No." := "Trade Partner No.";
UserRec."EDI Document No." := "EDI Document No.";
UserRec.Type := Type;
UserRec.Code := Code;
UserRec."Header Status Send Only" := "Header Status Send Only";
UserRec.Description := Description;
UserRec.Header := Header;
UserRec.Line := Line;
UserRec."Clear Line Codes" := "Clear Line Codes";
UserRec.INSERT;
MESSAGE('The table has been updated');
// I need to clear all the fields here, after inserting it into the table.
END;
Please let me know if my description is not clear or if you have any questions to help you answer mine.0 -
- What is the reason to use other table tu manual input data?
- Why do you want to delete data from input table after transferring them into "right" table?
If exists valuable reason to do it this way, my recommendations:
- use same fields and field numbers in working table and then use TRANSFERFIELDS command
- use CLEAR(Rec) to empty fields in working table after transferring fields into UserRec table
- Use messages if GUIALLOWED to make function ready to use in background scenarios
5
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions