The function is passing filters not record... may be I do not understand correctly, but you just needs one variable of type record for same table as the subform is based on, set the requested filters (e.g. on the Receipt ID field) and pass these filters by passing this variable as parmeter of the function described above...
IF lv_Length > 0 THEN BEGIN
lv_ReceptID := GetReceptID(Productcode);
lv_ReceptItem.SETFILTER(lv_ReceptItem.ReceptID,'%1',lv_ReceptID);
CurrForm.POProductFormuleSub.FORM.SETTABLEVIEW(lv_ReceptItem);
CurrForm.POProductFormuleSub.FORM.VISIBLE := TRUE;
END
ELSE IF lv_Length = 0 THEN BEGIN
CurrForm.POProductFormuleSub.FORM.VISIBLE := FALSE;
END;
The only problem is the update of the subform now...
Update of the subform was solved many times on this forum... just add something like UpdateForm function on the subform calling the CurrForm.UPDATE(False); and call this function from the main form...
Answers
How should i set the filtergroup for the subform?
SETFILTER("Customer Name",'ABC*');
FILTERGROUP(6);
SETFILTER("Customer Name",'*XYZ*');
FILTERGROUP(0);
Do i have to call this code inside the subform ?
Or just execute this in the main form?
function for how to set the filters on the subform...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
In my subform there is a tablebox which shows all record from the table Recept.
This table contains the Field ReceptID.
Now i like to filter the subform to show only the records who correspond to a given ReceptID
How to do that
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Its sort of working now using this code:
lv_Length := STRLEN(Productcode);
IF lv_Length > 0 THEN BEGIN
lv_ReceptID := GetReceptID(Productcode);
lv_ReceptItem.SETFILTER(lv_ReceptItem.ReceptID,'%1',lv_ReceptID);
CurrForm.POProductFormuleSub.FORM.SETTABLEVIEW(lv_ReceptItem);
CurrForm.POProductFormuleSub.FORM.VISIBLE := TRUE;
END
ELSE IF lv_Length = 0 THEN BEGIN
CurrForm.POProductFormuleSub.FORM.VISIBLE := FALSE;
END;
The only problem is the update of the subform now...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.