mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 6:01 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Applying USERID filter on a form
PostPosted: Sat Apr 28, 2012 6:06 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
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


Top
 Profile E-mail  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Sun Apr 29, 2012 3:01 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8700
Location: 3rd rock from sun
Country: United States (us)
I think somebody hits the ShowAll button which removes all the filters.

You need to use

FILTERGROUP(6);
SETRANGE("User ID",USERID);
FILTERGROUP(0);

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Tue May 01, 2012 5:05 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
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
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Tue May 01, 2012 7:10 pm 
Offline

Joined: Tue Mar 19, 2002 8:01 am
Posts: 206
Location: Vancouver
Country: Canada (ca)
Whats the source table you are using?

t


Top
 Profile  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Tue May 01, 2012 8:19 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8700
Location: 3rd rock from sun
Country: United States (us)
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.

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Tue May 01, 2012 9:28 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
Quote:
If they are then you'll need to populate the user id automatically.


I didnt get your point here.

Its a customized table.

Thanks

Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Applying USERID filter on a form
PostPosted: Tue May 01, 2012 9:37 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8700
Location: 3rd rock from sun
Country: United States (us)
If users are inserting new records on these forms, then on insert trigger in the table you need to add the code

Code: Select all
"user id" :=  USERID;

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: