FILTERGROUP(2) in Dimension lookup

I have a need to apply a FILTERGROUP(2) when Global Dim 1 is referenced but I cannot see how to specify the Dimension Code.

Dim1 = Project, Dim2 = Customer and Dim3 = Team

Dimension Value table has 2 extra fields, Customer No. - Table 18 and Shortcut Dimension 3 - Dim3. These fields are only used for Dim1

Obviously Form 560 is used for all dimensions in many situations.

My pseudo code so far and looking for a way to identify xxx:

IF xxx = GLSetup.“Global Dimension 1 Code” THEN BEGIN
IF UserSetup.GET(USERID) THEN BEGIN
IF UserSetup.“Team Filter” <> ‘’ THEN BEGIN
FILTERGROUP(2);
SETFILTER(“Shortcut Dimension Code 3” , UserSetup.“Team Filter”);
FILTERGROUP(0);
END;
END ELSE
ERROR(Text2000000,USERID); //(userid not set up)
END;

I need to make sure that any user with a filter for their Team will only be able to see records from Dim1 within the filter.

When using the same form for Dimension 2 etc, the filter is not applicable.

Anyone done anything similar?

Use SetRange instead of Setfilter.

SETRANGE is not good when the filter in the User Setup is AGE01|AGE07 or AGE* and so on.

I now have the solution.

The requirement was changed to use Team Global Dim 2.

Requirements:

Add Team Code (Dim2) to the Dimension Value table
When User looks up the Project (Dim1) from the Sales Order Header form, the filter is applied for the records where
the Team Code (Dim2) is within the filter as setup on the User Setup record.
If the user checks the Order/Dimensions and looks up the Team records, they must be filtered as per above.

Form 560

Form - OnOpenForm()
GLSetup.GET;
///This will only be used where the Dim 1 or 2 value exists and works OK
IF (“Dimension Code” = GLSetup.“Global Dimension 1 Code”) OR
(“Dimension Code” = GLSetup.“Global Dimension 2 Code”) THEN BEGIN
IF UserSetup.GET(USERID) THEN BEGIN
IF UserSetup.“Team Filter” <> ‘’ THEN
UserFilter := TRUE;
END ELSE
ERROR(Text2000000,USERID);
END;

Form - OnAfterGetRecord()
IF UserFilter then begin
if “Dimension Code” = GLSetup.“Global Dimension 1 Code” THEN BEGIN
FILTERGROUP(2);
SETFILTER(“Shortcut Dimension Code 2” , ‘%1’, UserSetup.“Team Filter”);
FILTERGROUP(0);
END;
IF “Dimension Code” = GLSetup.“Global Dimension 2 Code” THEN BEGIN
FILTERGROUP(2);
SETFILTER(Code , ‘%1’, UserSetup.“Team Filter”);
FILTERGROUP(0);
END;
END;
END;

The original lookup to populate the Dim 1 field is setup as follows:

Shortcut Dimension 1 Code - OnLookup(VAR Text : Text[1024]:wink: : Boolean
EXIT(LookupNumber(Text));

Table 36 - Function

**LookupNumber(**VAR Text : Text[1024]) : Boolean
Usersetup.GET(USERID);
lTeamFilter := Usersetup.“Team Filter”;
LDimValue.SETRANGE(“Global Dimension No.” , 1);
IF lTeamFilter <> ‘’ THEN
LDimValue.SETFILTER(“Shortcut Dimension Code 2”, lTeamFilter);
IF FORM.RUNMODAL(0,LDimValue) = ACTION::LookupOK THEN BEGIN
Text := LDimValue.Code;
EXIT(TRUE);
END;

The only remaining issue is that I cannot stop the user from using the Showall option when using the initial lookup.

[*-)]

Any ideas?