Home » Developer & Programmer » Forms » Enable\Disable menu items for different users
Enable\Disable menu items for different users [message #87050] Thu, 02 December 2004 01:00 Go to next message
Jamil
Messages: 13
Registered: December 2003
Junior Member
Dear friends
   I have this message FRM-41067 cannot find menu item invalid ID
   And I have coded this code under MENU STARUP CODE
DECLARE
  VAR_MENU  VARCHAR2(40);
  VAR_P VARCHAR2(40);
  VAR_ENABLE VARCHAR2(1);
  VAR_LOC VARCHAR2(40);
BEGIN 
       :GLOBAL.USER_NAME := Get_Application_Property(USERNAME); 
       SELECT M_ENABLE,LTRIM(RTRIM(NAME)),LTRIM(RTRIM(SUB_NAME))
           INTO VAR_ENABLE,VAR_MENU,VAR_P
         FROM MEN_TABLE
         WHERE USER_NAME=:GLOBAL.USER_NAME;
  
 IF   VAR_ENABLE = 'X' THEN      
             SET_MENU_ITEM_PROPERTY('VAR_MENU.VAR_P',ENABLED,PROPERTY_TRUE); 
    
ELSE
             SET_MENU_ITEM_PROPERTY('VAR_MENU.VAR_P',ENABLED,PROPERTY_FALSE); 
END IF;
END;

How can I solve the above problem 
And I want to use cursor for selecting the menu option from MEN_TABLE  and how can I do that with example

Waiting for  your valuable answer
Best Regards
Jamil 

 
Re: Enable\Disable menu items for different users [message #87056 is a reply to message #87050] Thu, 02 December 2004 17:05 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
first use find_menu_item to check the menu item is exists or not.

other wise u can use menu security instead of writing ur own code.

create roles and grant them to specified users.
1. in menu module property palette -- use security --yes
modulrs roles -- database role names

2. in menu item property palette -- item roles -- choose the role.

by
vamsi
Re: Enable\Disable menu items for different users [message #87062 is a reply to message #87050] Thu, 02 December 2004 22:46 Go to previous messageGo to next message
Himanshu
Messages: 457
Registered: December 2001
Senior Member
Hi,
Other than what Vamsi has told you remove single quotes form the menu name & rewrite the code as follows:

IF VAR_ENABLE = 'X' THEN
SET_MENU_ITEM_PROPERTY(VAR_MENU||'.'||VAR_P,ENABLED,PROPERTY_TRUE);

ELSE
SET_MENU_ITEM_PROPERTY(VAR_MENU||'.'||VAR_P,ENABLED,PROPERTY_FALSE);
END IF;

Actually what is happening that due to single quotes the system thinks that you wnat to enable or disable a Menu item which has a name VAR_MENU.VAR_P which are actually your variables.

So just rewrite your code as explained above.

It will work.

HTH
Regards
Himanshu
Re: Enable\Disable menu items for different users [message #87075 is a reply to message #87050] Fri, 03 December 2004 19:29 Go to previous messageGo to next message
Jamil
Messages: 13
Registered: December 2003
Junior Member
Dear Himanshu

Thank you very much for your help it works fine but can you help me how to do it with the cursor option because this one only for a single record, and also my main problem with this statement
:GLOBAL.USER_NAME := Get_Application_Property(USERNAME); because I am using this code in the Menu Startup Code , so I want to get variable :GLOBAL.USER_NAME can you give me an example how to do it with the cursor and where to code this statement
:GLOBAL.USER_NAME := Get_Application_Property(USERNAME);

Waiting for your valuable answer

Best regards

Jamil
icon4.gif  Re: Enable\Disable menu items for different users [message #112844 is a reply to message #87056] Tue, 29 March 2005 11:39 Go to previous messageGo to next message
Matloob
Messages: 39
Registered: December 2004
Member
I HAVE USED THE SAME WAY TO IMPLEMENT MENY SECURITY I HAVE CREATED SOME ROLES AND GRANTED THEM TO SOME USERS THE SET IT MENU PROPERTY TO USE SECURTIY TO TRUE
AND THEN ADD ROLES
AND ASSIGN THEM TO ITEMS
THE PROBLEM WHAT I M GETTING IS THAT WHEN EVER I RUN MY FORM HAVING THE MENU IT GAVE ME ERROR
THAT
"FRM-10256 User Is Not Authorize To Run Form Builder Menu"
I HAVE SUEDD IT WITH BOTH THE ROLE CREATER AND THE USER TO WHICH I HAVE ASSIGN THE ROLES BUT NO SOL.....
PLZ ANSWER MEE SOON THANKS
TAKE CARE BYE
Re: Enable\Disable menu items for different users [message #623270 is a reply to message #87050] Sun, 07 September 2014 12:15 Go to previous messageGo to next message
kilimanjaro
Messages: 151
Registered: May 2009
Location: Tanzania
Senior Member
Hello Jamil

I will appreciate if you can give me step by step instructions of how you managed to achieve this.I have tried your code but the cursor blinks at the 'Men_table'.This table I have not created it .please if you can give me its description too.General ,I'm using oracle forms 6i and I want some users to access only some menu items .

Thank you very much.
Re: Enable\Disable menu items for different users [message #623327 is a reply to message #623270] Mon, 08 September 2014 09:15 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Please realize that the message was posted 10 years ago, so you may not get any response.
icon4.gif  Re: Enable\Disable menu items for different users [message #689037 is a reply to message #87050] Tue, 29 August 2023 04:24 Go to previous messageGo to next message
mfahimaamirgmailcom
Messages: 64
Registered: May 2011
Location: pakistan
Member
My dear, I want to enable and disable menu items based on the user's rights
My code is in Menu Startup Code and the user security prosperity is yes

The name of my menu is MANUMENUWINDOW.mmx and the item names are test1, test2, test2.
the enable function property is yes  

I am longing with Scott
But when I run the form, Oracle gives me an error  frm-40738  argument 1 to builtin




DECLARE
USERNAME VARCHAR2(40);

BEGIN
USERNAME := Get_Application_Property(USERNAME);
SET_MENU_ITEM_PROPERTY('MANUMENUWINDOW.TEST1',ENABLED,PROPERTY_FALSE);
END;



DECLARE
USERNAME VARCHAR2(40);

BEGIN
USERNAME := Get_Application_Property(USERNAME);
SET_MENU_ITEM_PROPERTY('MANUMENUWINDOW.TEST1',ENABLED,PROPERTY_FALSE);
END;




need you valuable reply

regard
Re: Enable\Disable menu items for different users [message #689038 is a reply to message #689037] Tue, 29 August 2023 05:27 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
mfahimaamirgmailcom,

you shouldn't name local variables using the same name as parameters to built-in functions. The way you put it, it was as if you wrote GET_APPLICATION_PROPERTY(NULL) and that's invalid. Try something like

declare
  l_username varchar2(40);
begin
  l_username := get_application_property(username);

  -- the rest of your code goes here
end;
Re: Enable\Disable menu items for different users [message #689040 is a reply to message #689038] Thu, 31 August 2023 00:20 Go to previous message
mfahimaamirgmailcom
Messages: 64
Registered: May 2011
Location: pakistan
Member
Thank you for your reply

Dear Sir, I followed your instructions, but the system gave me an error at the time of running

the form.FRM-10256: User is not authorized to run Form Builder Menu

the form.FRM-10256: User is not authorized to run Form Builder Menu

see my code in startup code 

declare
  l_username varchar2(40);
begin
  l_username := get_application_property(username);
 SET_MENU_ITEM_PROPERTY('MANUMENUWINDOW.TEST1',ENABLED,PROPERTY_FALSE);
end;


sir see attached picture
Could you please guide me on Module Roles and how to define them
Now I'm logged in as Scott

I greatly appreciate your valuable guidance and assistance

Regard's



Previous Topic: how to disable menu item
Next Topic: Problem with menu item
Goto Forum:
  


Current Time: Thu Nov 21 06:21:45 CST 2024