Applying USERID filter on a form

liizz
Member Posts: 125
Hi all,
I have a form on which I want to apply filters based on the current system userid.
My codes is as follows:
Form - OnOpenForm()
SETRANGE("User ID",USERID);
Sometimes it gives the entries of this particular login but sometimes it shows all entries made by all users.
When it shows all the entries, I close the NAV application and restart my activity and then it is ok.
Please help where am wrong.
Thanks
Liizz
I have a form on which I want to apply filters based on the current system userid.
My codes is as follows:
Form - OnOpenForm()
SETRANGE("User ID",USERID);
Sometimes it gives the entries of this particular login but sometimes it shows all entries made by all users.
When it shows all the entries, I close the NAV application and restart my activity and then it is ok.
Please help where am wrong.
Thanks
Liizz
0
Comments
-
I think somebody hits the ShowAll button which removes all the filters.
You need to use
FILTERGROUP(6);
SETRANGE("User ID",USERID);
FILTERGROUP(0);0 -
Hi,
I have two forms with the same source table. One form shows the User ID and the other shows the Approver ID.
But, still when I use:
FILTERGROUP(6);
SETRANGE("User ID",USERID);
FILTERGROUP(0);
It prevents me from creating a new entry and I have to restart NAV application on the first form. I think the problem comes with the filters and it is not cleared. The source table is also blank.
I have read this thread: http://www.mibuso.com/howtoinfo.asp?FileID=22
Some advice: Only start using filtergroups from 10 and up. Filtergroups 0 to 6 are reserved (see the C/SIDE reference guide for more info), but I would keep some extra filtergroups free for the future (until some versions ago, filtergroup 6 was NOT reserved).
Can I use this instead:
1st form:
IF UserSetup.GET(USERID) THEN BEGIN
FILTERGROUP(10);
SETRANGE("User ID",UserSetup."User ID");
FILTERGROUP(0);
END;
2nd form:
FILTERGROUP(10);
SETRANGE(Approver,USERID);
SETFILTER(Status,'%1',Status::Released);
FILTERGROUP(0);
Is it a best way to fix this issue out??
Please advise me and help me sort it out.
Thanls
Liizz0 -
Whats the source table you are using?
t0 -
I don't see anything wrong with your code.
You'll need to test it and make sure it works if users are entering records. If they are then you'll need to populate the user id automatically.0 -
If they are then you'll need to populate the user id automatically.
I didnt get your point here.
Its a customized table.
Thanks
Liizz0 -
If users are inserting new records on these forms, then on insert trigger in the table you need to add the code
"user id" := USERID;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions