Help with a VISIBLE instruction

DarkHorse
Member Posts: 389
Dear folks, on OnOpenform from a form I've the instruction:
CurrForm.field.VISIBLE(USERID<>'USER');
It's to prevent some usersview a given field, it runs well. I want put more than an user but I don't know how. How should be the code, please?. Also, in this case, how should be not VISIBLE instruction?
Thanks in advance.
CurrForm.field.VISIBLE(USERID<>'USER');
It's to prevent some usersview a given field, it runs well. I want put more than an user but I don't know how. How should be the code, please?. Also, in this case, how should be not VISIBLE instruction?
Thanks in advance.
0
Comments
-
IF USERID = 'USER' THEN
CurrForm.field.VISIBLE:=FALSE;0 -
Thanks but doesn't works. I put several users and hide the field correctly, but, following, enter an user that can see the field but it remains hide. The field is a boolean type one, I don't know if it can be a reason. Any other solution please?.
Thanks for help.0 -
Hi
I think is better if you use CASE instruction
Case USERID of
'USER1': CurrForm.field.VISIBLE:=FALSE;
'USER2': CurrForm.field.VISIBLE:=FALSE;
'USER3': CurrForm.field.VISIBLE:=FALSE;
'USER4': CurrForm.field.VISIBLE:=FALSE;
else
CurrForm.field.VISIBLE:=TRUE;
end;
Regards0 -
That's right!!! =D> , it works; thanks for help.
Best regards.0 -
That is horrible coding. You have required the customer to come back to you every time they want to give a new user permission to view / not view that field.
How about a separate form with standard NAV security? Some people have access to one form, others have access to the other form.
Not as good, but a flag in user setup would also do the trick. If the field allowing permission for that field is checked for the user, show the field, otherwise hide it.
The solution you have written, although it does the job, is the worst way to do it.0 -
matttrax wrote:That is horrible coding. You have required the customer to come back to you every time they want to give a new user permission to view / not view that field.
How about a separate form with standard NAV security? Some people have access to one form, others have access to the other form.
Not as good, but a flag in user setup would also do the trick. If the field allowing permission for that field is checked for the user, show the field, otherwise hide it.
The solution you have written, although it does the job, is the worst way to do it.
I agree 100%.
I have a client that has code like this all through their database, written by their partner. In the end they went out and bought the Solution developer and Application Builder, because that was cheaper in the long run that what it cost their partner to keep adding users.David Singleton0 -
matttrax wrote:That is horrible coding.
<snip>
The solution you have written, although it does the job, is the worst way to do it.0 -
matttrax wrote:That is horrible coding.
One additional comment. If your code is on the OnOpen trigger of a list form then what will happen if the use Right-clicks the column header and selects "Show Clumn"?
There are solutions but I think the best approach is to use different forms with permissions.0 -
DenSter wrote:matttrax wrote:That is horrible coding.
<snip>
The solution you have written, although it does the job, is the worst way to do it.
Or you can add a new boolean field in User Setup (T91) Table.
And all the code is reduced to 2 lines
If TuserSetup.get(USERID) then;
currform.control.visible:=TUserSetup."New field";
Regards0 -
-
Saalek wrote:If TuserSetup.get(USERID) then;0
-
DenSter wrote:Saalek wrote:If TuserSetup.get(USERID) then;
viewtopic.php?f=23&t=33597NAV - Norton Anti Virus
ERP Consultant (not just Navision) & Navision challenger0 -
idiot wrote:0
-
Can I add an extra way to do it?
http://www.mibuso.com/forum/viewtopic.php?t=38353.
I think this way is the best version of all : No need to maintain 2 forms and no need to reprogram to add/remove a user.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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