mibuso.com

Microsoft Business Solutions online community
It is currently Mon May 20, 2013 7:06 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: setrange
PostPosted: Thu Aug 16, 2012 8:42 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Hi Expert,
I created a report and I want only A, B, C to view it, but it looks like it does not work, how to fix it? Thanks!

IF TempUser = 'Abc' THEN
BEGIN
"Salesperson/Purchaser".SETRANGE(Code, 'A', 'B', 'C') ;


TempAllow := TRUE;
END;


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 9:38 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
I'm not getting it.

at one point you have 'abc' and another you have 'a','b','c'.

can you explain a bit better?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 9:42 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Thank yoiu Savatage for your quick response! Yes, I want ABC (the person) to view only the records of A, B, C.
But after I add my code, the ABC can not only see the records of A, B, C, but also D, E, F. Please advise! Thank you very much!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 10:13 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
So what do you want to happen if it's NOT user ABC? See all?

or it a report that only should show 'a' , 'b', & 'c'?

if so why not just set the DataItemTableView property to only deal with 'a' , 'b', & 'c'?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 10:31 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
I cannot do that, otherwise, when DEF login, he cannot see his sales, but only A's part since it is filtered in the tableviwe. We have serveal sales, each can only view his own sales in the report after login. Currentyly we mixed some of A's accounts with some the B's accounts, so when ABC ( to be exact, ABC is A) login and view the report, he can see his own sales (A), but he can also see some of the mixed sales (B, to be exact, it is AB since some of A's sales mixed with some of the B's sales, or AC). Please advise!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 10:39 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
ok so you have a bunch of possibilities.

where are you putting your code?

Do you have sales figures in the salesperson/purchaser table?

it confusing.

looks like you are going to need alot of "if statments" for each possibility
and use currreport.skip if it doesn't fit your criteria.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 10:58 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Thank you Savatage! Before we mixed the accounts, it works well. I am suing setfilter instead of setrange. You are right I am using lot of 'if'.
BTY, you mentions the configuration in the sales/purchase table, any adivce? Thank you!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Thu Aug 16, 2012 11:35 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Also when I am using the following code, I have some issues.

IF TempUser = 'A' THEN

BEGIN

"Salesperson/Purchaser".SETFILTER(Code, 'A') ;


TempAllow := TRUE;
END;

IF TempUser = 'A' THEN

BEGIN

"Salesperson/Purchaser".SETFILTER(Code, 'AB') ;


TempAllow := TRUE;
END;
IF TempUser = 'A' THEN

BEGIN

"Salesperson/Purchaser".SETFILTER(Code, 'AC') ;


TempAllow := TRUE;
END;

A can only see the records for AC, but cannot view his own A and AB. Please advise!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 12:15 am 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Please advise, experts!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 12:39 am 
Offline

Joined: Sat Feb 18, 2012 2:42 am
Posts: 53
Location: Portland, OR
Country: United States (us)
Pretty confusing. You are using three IF commands using the same IF TempUser := 'A' ... so it'll filter only on the last one.

Are you trying to filter the records by the Salesperson or by the person who has logged into NAV?


Top
 Profile E-mail  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 12:46 am 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Yes, I am filtering the records by the person who loggin into the NAV. Is there any better way to achieve this. Thank you!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 1:07 am 
Offline

Joined: Sat Feb 18, 2012 2:42 am
Posts: 53
Location: Portland, OR
Country: United States (us)
Ok, now we are getting somewhere. In the report, what's the criteria (filter) you want to use for a user to view some records but not others? In other words, for your DataItems in your report, is there a field or fields we can filter on to get the desired result?


Top
 Profile E-mail  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 6:03 am 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
It is the item sales report with two tables (salesperson/Purchaser and Item Variant). I modified the original report, where each salesperson can only view his own sales after login. We have some big customers whom several sales share with, and so we created some new salespersons which are combined with each other, but it makes it difficult for each sales to view his individual mixed accounts sales. Currently we use the salesperson as the filter field. Could you advise?
Thank you!


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 10:31 am 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 987
Location: Earth
Country: Netherlands (nl)
Oh god, not even basic concepts are understood.

Read the help on filters, on how to combine filters and which operators to use.

Also read up on setfilter and setrange in the help.

Anyway, your filter for your salespersons should be either combined or otherwise split (show own sales first and communist sales second, possible when its a report, not in a form/page without additonal programming)

For salesperson A who has worked with salesperson B and C you either filter once with the following string
A|AB|AC (equals to A or AB or AC)
B|AB|BC for salesperson B

Every time you use setrange/setfilter on a records field, the previous filter of that field is overwritten.

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
 Post subject: Re: setrange
PostPosted: Fri Aug 17, 2012 4:56 pm 
Offline

Joined: Fri Jan 27, 2006 5:47 am
Posts: 213
Location: USA
Country: United States (us)
Thank you! It is working now. :lol:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 18 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: