cannot understand what is the problem [message #678760] |
Tue, 07 January 2020 14:14 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/ed0959029426c2af7010459657ca79e4?s=64&d=mm&r=g) |
Oraclinho
Messages: 9 Registered: December 2018
|
Junior Member |
|
|
When I add a new user as admin in users table and assigned setting for that in forms to appear somethings only for admins and disappeared for others, So I added the following code in (when new form instance) trigger .... knowing that in the form property in where condition section there is a condition (End_Date is null) ...
set_window_property(forms_mdi_window,window_state,Maximize);
set_window_property('GH_STR_STORES_WIN',window_state,maximize);
if :global.user_name = '123456' or :global.user_name = '456789'
and :global.pass = '654321' or :global.pass = '987654' then
set_block_property ('STORES',default_where,'END_DATE IS NOT NULL');
set_item_property('STORES.END_DATE', VISIBLE, property_TRUE);
set_item_property('STORES.END_DATE', ENABLED, property_TRUE);
execute_query(no_validate);
set_block_property ('STORE_DT',default_where,'END_DATE IS NOT NULL');
set_item_property('STORE_DT.END_DATE', VISIBLE, property_TRUE);
set_item_property('STORE_DT.END_DATE', ENABLED, property_TRUE);
end if;
when I enter to that screen by one of those admin users and pressed ctrl + f11 to execute .... there is no data displayed ?!!!
Although when I enter to that screen by another normal user and pressed ctrl + f11 to execute .... I can review the data !!!
I don't know the reason of that problem ?!!
anyone can help ?!!
|
|
|
Re: cannot understand what is the problem [message #678766 is a reply to message #678760] |
Wed, 08 January 2020 03:32 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13921 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
So first guess is that nothing in the table satisfies the where clause.
If you think otherwise then I suggest you make use of the block property last_query to see exactly what query forms issued to the DB (I'd add an item to the form and populate that with last_query so you can copy and paste)
|
|
|
Re: cannot understand what is the problem [message #678771 is a reply to message #678760] |
Thu, 09 January 2020 02:14 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
You did not post whether there is any relationship between admin/normal users and used :global.user_name/pass variables.
If so, note that in most languages, AND condition has higher precedence than OR. If Forms act also so, the condition in IF statement would be evaluated as
:global.user_name = '123456' or (:global.user_name = '456789'
and :global.pass = '654321') or :global.pass = '987654'
If you want to call the inside code in different cases, use parenthesis in that condition appropriately.
You should use parenthesis in conditions with different logical operators anyway.
|
|
|
|
Re: cannot understand what is the problem [message #678782 is a reply to message #678772] |
Fri, 10 January 2020 13:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.gravatar.com/avatar/ed0959029426c2af7010459657ca79e4?s=64&d=mm&r=g) |
Oraclinho
Messages: 9 Registered: December 2018
|
Junior Member |
|
|
I found the problem was lack of my attention .... as I found that there is (where condition) in form property that .. END_DAT IS NULL while I put a trigger (when new form instance) that check if user is admin so it deals with the form as if END_DATA IS NOT NULL at the same time which cause a conflict that produce this problem ..... I appreciate your answers and trials to help me in solving this issue.
|
|
|