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.
0
Answers
- clearing all global variables must be done by code behind the Add button
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.
- 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