抑制/清除 oracle 表单 10g 中的消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17820226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Suppress/clear messages in oracle forms 10g
提问by Lawtonfogle
I have some validation code that, when a user tries to save, will run through some complex business rules and determine if the current data entered matches the rules enough so to allow a save. If not, an error message telling them what rule is in violation is put at the bottom of the screen using message('All foos of type bar must qux.')
.
我有一些验证代码,当用户尝试保存时,它会运行一些复杂的业务规则,并确定当前输入的数据是否与规则足够匹配以允许保存。如果没有,则会使用 将一条错误消息告诉他们违反了哪些规则message('All foos of type bar must qux.')
。
When they exit the form, it also runs against validation, and if successful, asks them if they want to save (using the built in question). If not successful, I have an alert that informs them all data will be lost and asks if they still wish to exit. The trouble is, when they click 'Exit Anyway', the validation message pops up. Once they click ok, the form closes as expected.
当他们退出表单时,它也会针对验证运行,如果成功,询问他们是否要保存(使用内置问题)。如果不成功,我会收到一个警报,通知他们所有数据都将丢失,并询问他们是否仍希望退出。问题是,当他们单击“仍然退出”时,会弹出验证消息。单击确定后,表单将按预期关闭。
I'm attempting to suppress/clear messages so that this popup doesn't happen. I've tried changing the message level but it still pops up. I've tried sticking in a message('', NO_ACKNOWLEDGE)
but that only lets me control where in my if/else chains I want the message to popup.
我正在尝试抑制/清除消息,以免出现此弹出窗口。我已经尝试更改消息级别,但它仍然弹出。我试过坚持 amessage('', NO_ACKNOWLEDGE)
但这只能让我控制我的 if/else 链中我希望消息弹出的位置。
Is there some clear_messages
or such I can do to just cancel all messages on the form waiting to be displayed?
clear_messages
我可以做一些或这样的事情来取消表单上等待显示的所有消息吗?
As it currently stands, if I do
按照目前的情况,如果我这样做
message('something')
I get a message in the status bar.
我在状态栏中收到一条消息。
If I do
如果我做
message('something')
message('something else')
the second one is in the message bar while the first one pop ups on the screen.
第二个在消息栏中,而第一个在屏幕上弹出。
I am asking if there was a way to keep the first message from popping up. This is clearly something being done in oracle forms, and I've already explained a few attempts to clear it. Yes, I don't understand how to clear the status bar to keep the message from popping up, which is the whole reason I asked the question.
我在问是否有办法防止第一条消息弹出。这显然是以 oracle 形式完成的,我已经解释了一些清除它的尝试。是的,我不明白如何清除状态栏以防止消息弹出,这就是我问这个问题的全部原因。
Perhaps I need to note why
也许我需要说明为什么
message('something', no_acknowledge);
message('something else');
does not solve my problem?
没有解决我的问题?
If that is the case, the reason is because the first message is being printed out by a program unit where in all cases except this one, I want it to popup if another message comes in.
如果是这种情况,原因是第一条消息是由程序单元打印出来的,在除此之外的所有情况下,如果另一条消息进来,我希望它弹出。
In other words, I have
换句话说,我有
function do_something return number is
...
begin
...
message('something');
...
end;
where do_something handles running against some business rules.
其中 do_something 处理违反某些业务规则的运行。
Elsewhere, in the key-exit trigger I have
在其他地方,在钥匙退出触发器中,我有
...
if do_something = 0 then
if Show_Alert('Alert_that_explains_data_is_not_being_saved_due_to_validation_failure') = alert_button 1 then
exit_form(no_validate);
end if;
else
exit_form;
end if;
...
and in every other case except this one, when I call do_something, I want the message to pop up when another message is put on the status bar, but in this one case, I don't want it to be. As such, I'm asking if there is a way to clear the message or suppress it so that it doesn't pop up in this case.
在除此之外的所有其他情况下,当我调用 do_something 时,我希望在状态栏上放置另一条消息时弹出消息,但在这种情况下,我不希望它如此。因此,我在问是否有办法清除消息或抑制它,以便在这种情况下它不会弹出。
回答by GriffeyDog
You can set :system.message_level to some value > 0 to suppress certain levels of messages, and then set it back when you want normal processing.
您可以将 :system.message_level 设置为某个值 > 0 以抑制某些级别的消息,然后在需要正常处理时将其重新设置。
From the online help within Forms Builder:
从 Forms Builder 中的在线帮助:
Working with Forms Runtime Messages
To control the messages that end users see when they use a Oracle Forms application, you can: use the SYSTEM.MESSAGE_LEVEL system variable to suppress specific "severity levels" of messages use On-Error and On-Message triggers to replace the standard processing of messages use the SYSTEM.SUPPRESS_WORKING system variable to prevent the update of an end user's screen (by suppressing the "Working..." message) Message Severity Levels
Forms Runtime messages are ranked by severity. Use the SYSTEM.MESSAGE_LEVEL system variable to can control the minimum severity level that displays to end users.
There are six levels of message severity that you can affect, listed here in increasing order of severity.
Level
Message Description
0
All types of messages from the other levels of severity.
5
Reaffirms an obvious condition.
10
Indicates that the end user has made a procedural mistake.
15
Declares that the end user is attempting to perform a function for which the form is not designed.
20
Indicates a condition where the end user cannot continue an intended action due to a problem with a trigger or another outstanding condition.
25
Indicates a condition that could result in the form performing incorrectly.
25
Indicates a message severity level that you cannot suppress via the SYSTEM.MESSAGE_LEVEL system variable.
Severity levels of individual Forms Runtime messages are labelled with "Level" in the Oracle Forms online help system. Message Types
To use On-Error and On-Message triggers to replace Forms Runtime messages, you need to be aware of the three types of Forms Runtime messages:
Informative Informs end users of the present state of processing (e.g., Last value retrieved.) or provides end users with context-sensitive guidance (e.g., Press [Accept] to enter answer.). Use the On-Message trigger to suppress the appearance of these messages.
Error Inform end users of error conditions that prevent the end user's actions (e.g., Function key not allowed. Press [Show Function Keys] for list of valid keys.). Use On-Error triggers to suppress the appearance of these messages. However, you cannot suppress error messages that appear on the command line (e.g., Too many arguments on command line.).
Working Inform end users that Oracle Forms currently is processing (e.g., Working...). You cannot use On-Error or On-Message triggers, or the SYSTEM.MESSAGE_LEVEL system variable to suppress these messages.
Message types of individual Forms Runtime messages are labelled with "Type" in the Form
Related topics
SYSTEM.MESSAGE_LEVEL examples
On-Error Trigger
On-Message Trigger
About handling runtime errors in triggers
使用表单运行时消息
要控制最终用户在使用 Oracle Forms 应用程序时看到的消息,您可以: 使用 SYSTEM.MESSAGE_LEVEL 系统变量来抑制消息的特定“严重性级别” 使用 On-Error 和 On-Message 触发器来代替标准处理消息使用 SYSTEM.SUPPRESS_WORKING 系统变量来防止更新最终用户的屏幕(通过抑制“正在工作...”消息)消息严重性级别
表单运行时消息按严重性排序。使用 SYSTEM.MESSAGE_LEVEL 系统变量可以控制向最终用户显示的最低严重性级别。
您可以影响六个级别的消息严重性,此处按严重性升序列出。
等级
消息说明
0
来自其他严重性级别的所有类型的消息。
5
重申一个明显的条件。
10
表示最终用户犯了程序错误。
15
声明最终用户正在尝试执行未设计表单的功能。
20
表示由于触发器或其他未决条件的问题,最终用户无法继续执行预期操作的条件。
25
表示可能导致表单执行不正确的条件。
25
指示不能通过 SYSTEM.MESSAGE_LEVEL 系统变量抑制的消息严重性级别。
各个 Forms Runtime 消息的严重级别在 Oracle Forms 联机帮助系统中标有“级别”。消息类型
要使用 On-Error 和 On-Message 触发器来替换 Forms Runtime 消息,您需要了解 Forms Runtime 消息的三种类型:
信息性 通知最终用户当前的处理状态(例如,检索到的最后一个值。)或为最终用户提供上下文相关的指导(例如,按 [接受] 输入答案。)。使用 On-Message 触发器来抑制这些消息的出现。
错误 将阻止最终用户操作的错误情况告知最终用户(例如,不允许使用功能键。按 [显示功能键] 可查看有效键的列表。)。使用 On-Error 触发器来抑制这些消息的出现。但是,您不能抑制出现在命令行上的错误消息(例如,命令行上的参数过多。)。
工作通知最终用户 Oracle Forms 当前正在处理(例如,工作...)。您不能使用 On-Error 或 On-Message 触发器或 SYSTEM.MESSAGE_LEVEL 系统变量来抑制这些消息。
单个 Forms Runtime 消息的消息类型在 Form 中标有“Type”
相关话题
SYSTEM.MESSAGE_LEVEL 示例
错误触发
消息触发
关于处理触发器中的运行时错误
回答by Lawtonfogle
I did come up with a solution for this, but not a great one. In the validation function I created, I passed another variable (an int that is set to either 0 or 1) that only indicates if I wanted the message to be a popup message or not, basically either calling message('warning...')
or message('warning...', no_acknowledge)
. I then marked each call to the validate function if I wanted it to be displayed where it would popup or not.
我确实为此提出了一个解决方案,但不是一个很好的解决方案。在我所创建的验证函数,我通过另一个变量(它被设置为0或1的int),只有当我想要的消息是一个弹出消息或没有,基本上任一呼叫指示message('warning...')
或message('warning...', no_acknowledge)
。然后,如果我希望它显示在它会弹出或不弹出的地方,我会标记对验证函数的每个调用。
I would still prefer a some way that I could call only in certain locations that would clear what ever message is at the bottom of the form so it does not popup even if it hasn't been set with no-acknowledge because my current solution does not seem optimal, but if anyone else is having the same issue, hopefully this will be able to work even if it doesn't look pretty.
我仍然更喜欢某种方式,我只能在某些位置调用它可以清除表单底部的任何消息,因此即使没有设置它也不会弹出,因为我当前的解决方案确实如此似乎不是最佳的,但如果其他人有同样的问题,希望即使它看起来不漂亮也能正常工作。