|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
lock indicator to specific user |
ICL
|
Post subject: lock indicator to specific user |
Post rating: 0
|
Posted: Tue 10 Apr, 2012, 12:30
|
|
User rating: 0
Joined: Thu 29 Mar, 2012, 15:52 Posts: 10
|
Dear Support,
Is there a way I can lock a custom indicator to a specific user ID.
for example,
If (UserID = "DEMO**** ") {access = 1;} else {access = 0;}
Thank you
|
|
|
|
 |
jlongo
|
Post subject: Re: lock indicator to specific user |
Post rating: 2
|
Posted: Wed 11 Apr, 2012, 01:44
|
|
User rating: 94
Joined: Mon 06 Feb, 2012, 12:22 Posts: 357 Location: Portugal, Castelo Branco
|
Hi ICL: I don't have tested, just searching in wiki and javadoc, but i think you can get that info with: private IAccount accountData; private String login;
....
accountData = context.getAccount(); login = accountData.getAccountId(); I hope that helps. Best regards Trade well and good luck JL
|
|
|
|
 |
ICL
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 12:57
|
|
User rating: 0
Joined: Thu 29 Mar, 2012, 15:52 Posts: 10
|
Hello,
Thank you for your reply. I tried this without much success. Any other idea's would be appreciated.
Thanks.
|
|
|
|
 |
API Support
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 13:05
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
As already another user mentioned - just check the account id in the onStart method: public void onStart(IIndicatorContext context) { context.getConsole().getOut().println(context.getAccount().getAccountId()); }
If this is not usable in your case then provide more details on how the functionality should work.
|
|
|
|
 |
ICL
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 14:04
|
|
User rating: 0
Joined: Thu 29 Mar, 2012, 15:52 Posts: 10
|
Thank you. Works perfectly but it prints the ID 3 times. any ideas why?
Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 14:09
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Because the onStart method gets called not only on indicator start but also on the indicator validation when it gets loaded in platform.
|
|
|
|
 |
ICL
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 14:50
|
|
User rating: 0
Joined: Thu 29 Mar, 2012, 15:52 Posts: 10
|
Thanks, so I tried the following but it doesn't work and it keeps returning false. Could you tell me where I am going wrong? Thank you private string login;
public void onStart(IIndicatorContext context) { context.getConsole().getOut().println(context.getAccount().getAccountId()); login = context.getAccount().getAccountId(); }
......
public IndicatorResult calculate(int startIndex, int endIndex) { if (login == XXX) {valid = 1;}; else {valid=0;} ....... }
|
|
|
|
 |
API Support
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 14:55
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
use String.equals or String.equalsIgnoreCase otherwise instead of strings you compare object references.
|
|
|
|
 |
ICL
|
Post subject: Re: lock indicator to specific user |
Post rating: 0
|
Posted: Wed 11 Apr, 2012, 15:09
|
|
User rating: 0
Joined: Thu 29 Mar, 2012, 15:52 Posts: 10
|
sorry, rookie mistake! Thank you very much.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|