Validation field with condition

Dear all,

I have a situation :

I had a field TEAM (value : A, B ,C ) with relative Table TEAM ,

So now I want filter UserID with current his team was : A , just can view Data Item on Field TEAM : A. when he select on Form.

is it can be do that? I will do filter on Form or Table?

Please advices me!

Thanks so much.

can you be more clear?

is it similar to your previuos post?

http://dynamicsuser.net/forums/p/45552/230461.aspx#230461

Thanks your quick action, It’s different scenario .For more clear :

Because my company have 05 user , every user will join 04 different team.

Ex : User 1 is Team A

User 2 is Team B

User 3 is Team C

User 4 is Team D

User 5 is Team A & B

On Request Form - I give them select View Report by Team , but now I want User 1 just can see and select Team A on Field Team.

Sorry about my English…

Thanks

Did you write any code in OnLookup trigger of the field in request form?

Until I just have a little code for auto fill Team value in Team field according UserID, but dont know how hide data that not match…

First you need to get the team names which are assigned to user(i think from Usersetup table)

Filter those team codes in TEAM table

finally call the TEAM form by passing the Filteres team record

IF FORM.RUNMODAL(,) = ACTION::LookupOK THEN;

Great, thanks so much. I’m understand…but have a little bit…how can assign to user have many Team

is it for usersetup or in request form?

because I’m not yet assigned user for join many team.I think we’re need modify both UserSetup Table and Team Table…but is it can be ? If user have enough data we’re can filter by your suggest…until now they’re just have 01 team in record.

You need to change only usersetup table…

add a text field where user can setup like TeamA|TeamB

you need ti filter the team record based in that new field and pass it to form as i said above…

Ohh, is it can be input data like TeamA|TeamB in a Table Field? ohhh,really this is my solutions until now…

If it is a text type field (in usersetup)

Dear, I’m try with TeamLead Field in Table UserSetup with value : TeamA|TeamB|TeamC

by Code:

setteam.SETRANGE(“TeamLead”,‘TeamA’);
IF FORM.RUNMODAL(5107,setteam) = ACTION::LookupOK THEN;

But Not successsul, pleas advises me.

Thanks

something like

Usersetup.Get(USERID);

setteam.RESET;

setteam.SETFILTER(“TeamLead”,’%1’,Usersetup.);

.SETTABLEVIEW(setteam);

.SETRECORD(setteam);

.LOOKUPMODE(TRUE);

IF .RUNMODAL = ACTION::LookupOK THEN BEGIN

.GETRECORD(setteam);

:= setteam.team;

END;

Please contact your senior for more help…

I think that trying to force this solution into the User Setup table is making it harder than it needs to be. The cleanest way to do it in my opinion is also the more standard approach for representing many-to-many relationships.

In your situation, you have many users and many teams. If it were not possible for a user to be on more than one team, then putting the solution in the User Setup table would be acceptable. But, since users can be on more than one team, you need to take a different approach.

You already have your user date in either User or User Setup (your choice.) You need to create a list of available teams in a lookup-type table. I’d call it Team, with two fields, Code10 (Primary Key) and Description (Text30-50). This is just a list table. Then, you’ll create a table called User Team in which you will establish relationships between users and teams. This table would need at least two fields - User Code, and Team Code. You could add flowfields for each of those two fields as well so you can clearly see which user is on what team when you display the User Team List form.

Now that you have the data in the optimal format, when you run your report you only need to filter the User Team table by the User Code to know which teams the user belongs to. From there, you can decide which menu options to show him on the request form. If you think about it, you’ll see that you can use the User Team table in this way to allow the user to chose which team to run the report for rather than trying to manipulate an option list.

I hope that helps.

I’m going to Table User Setup and more 02 files TeamCode2 and TeamCode3 with relation: Team Table.

At trigeer Request Form - OnActive ( ) I was insert this code :

salesman.GET(USERID);
SalemanFilter := FORMAT (salesman.“Salespers./Purch. Code”);
SalemanFilter2 := FORMAT (salesman.“Salespers./Purch. Code”);

team1.SETCURRENTKEY(“Salesperson Code”);
team1.SETRANGE(“Salesperson Code”, SalemanFilter);

IF team1.FINDFIRST THEN
BEGIN
team1.VALIDATE(“Salesperson Code”, SalemanFilter);
TeamFilter := FORMAT (team1.“Team Code”);
TeamFilter2 := FORMAT (team2.TeamCode2);
setteam.SETFILTER(“Team Code”,’%1’, TeamFilter);
setteam2.SETFILTER(TeamCode2,’%1’, TeamFilter2);
IF FORM.RUNMODAL(5107,setteam) = ACTION::LookupOK THEN;

END

And the result just only have appear TeamCode of UserID , not show TeamCode2 …

Could you advises me pls…thanks so much.