I've used two methods to pass values from one form to another. The first is creating a function in the form I'm going to call that allows me to pass in the values. Then in my calling code I'll define the form as a variable and before running call the function passing in the values.
The second method is to put a filter on a field in the record variable that you pass into the form when you RUN or RUNMODAL. Then use GETFILTER to retreive the filter value from the field and clear the filter in the OnInit trigger.
Thanks DigiTecKid, but how to use GETRECORD function to fetch record from a form.
Eg : I have a Form "A" with a field "Name". From there I will open another form say "B". If I want to use the value of Name field from Form "A" how I have to use GETRECORD function?
From what you are saying then you would have Form "A" that has the Form "B" defined as a variable - FormB. You will also have a variable in Form "A" that is the source table for Form "B" - FormBRec.
IF FormB.RUNMODAL = ACTION::OK then
FormB.GETRECORD(FormBRec);
From there you the FormBRec.Name to use in the code.
I also believe another was to do this is do it with:
IF FORM.RUNMODAL(FORM::"Form B", FormBRec) <> ACTION::OK then
clear(FormBRec);
The FormBRec passed in will have the record selected when the form was closed.
I have a slightly different problem relating to transfering data between two forms.
As standard, after the code Form.RUNMODAL = ACTION::LookupOK the function GETRECORD will be called, so that only one record is known.
Is there anyway to pass through the user selection or the filters that have been applied.
You have SETSELECTIONFILTER within Forms, but it is not something you can call from another form obviously
To complicate this even more, the tables between the two forms are temporary and the way I initially tried to solve the problem would only work if insert permanently to the table I needed, creating it's own problems
The reason for this, is that a user wants to be able to select multiple Serial Numbers (via Item Tracking Lines) and at the moment only one can be selected at a time through the AssistEdit on the Item Tracking Lines form. Therefore I am trying to replicate this without the AssistEdit (calling my own code and form), but the use of temporary tables is causing me a few headaches
Have you seen Function GetSelectionFilter() in form 18 G/L Account List ?
It is used when you Lookup the Totalling field on the Chart of Accounts Form.
Comments
The second method is to put a filter on a field in the record variable that you pass into the form when you RUN or RUNMODAL. Then use GETFILTER to retreive the filter value from the field and clear the filter in the OnInit trigger.
Eg : I have a Form "A" with a field "Name". From there I will open another form say "B". If I want to use the value of Name field from Form "A" how I have to use GETRECORD function?
Thanks,
N.Sridhar
IF FormB.RUNMODAL = ACTION::OK then
FormB.GETRECORD(FormBRec);
From there you the FormBRec.Name to use in the code.
I also believe another was to do this is do it with:
IF FORM.RUNMODAL(FORM::"Form B", FormBRec) <> ACTION::OK then
clear(FormBRec);
The FormBRec passed in will have the record selected when the form was closed.
As standard, after the code Form.RUNMODAL = ACTION::LookupOK the function GETRECORD will be called, so that only one record is known.
Is there anyway to pass through the user selection or the filters that have been applied.
You have SETSELECTIONFILTER within Forms, but it is not something you can call from another form obviously
To complicate this even more, the tables between the two forms are temporary and the way I initially tried to solve the problem would only work if insert permanently to the table I needed, creating it's own problems
The reason for this, is that a user wants to be able to select multiple Serial Numbers (via Item Tracking Lines) and at the moment only one can be selected at a time through the AssistEdit on the Item Tracking Lines form. Therefore I am trying to replicate this without the AssistEdit (calling my own code and form), but the use of temporary tables is causing me a few headaches
Have you seen Function GetSelectionFilter() in form 18 G/L Account List ?
It is used when you Lookup the Totalling field on the Chart of Accounts Form.
It might help you...