Question

how to write a list trigger procesure

Asked by: wasabi3689

I am developing a oracle form ( form version 11.0.0)

I created a list item named "status" on a form. There are 3 elements in the drop-down list
IN_PROGRESS','REQUESTED','CANCELED'

When the form opened, if To cancel a record, simply changed Requested to Cancelled. This is only allowed for records with a status of Requested. An error message will be given if attempted for other statuses.

Here is what I want to do

1. I want to create a trigger but I don't know which trigger is the best fit
when-mouse-click or when-list change
2. create the procedure

if' statu's field value is "requested' needed to canceled by selecting the drop-down list, do the update query.
if  status field value is not "requested' and user wants to select the drop-down list to change something else, should come up a message can stop it.

How to develop this procedure?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-01-07 at 09:22:42ID24032174
Tags

PL/SQL

Topics

PL / SQL

,

Oracle 8.x

,

Oracle Database

,

Oracle 10.x

,

Oracle 11.x Database

Participating Experts
2
Points
500
Comments
47

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. triggers
    oracle8. I want to write a trigger that automatically fills date columns on insert and update of a row. my problem is - how do i refer to the row i want to update? (i mean - in the trigger i write : update try_tab set trydate=sysdate where...?)
  2. TRigger
    I have a trigger on update or delete. Does Oracle has a variable to figure out inside trigger's body what event happend update or delete. I don't like to write separate triggers with almost the same logic. Thanks.
  3. Trigger
    hello experts, i want to create trigger in which case it should create a table at sunday 12.00 noon and drop the table on the next day 1.00 noon automatically ?? i mean is it really possible if so can u just show me with an example?? Thanxs Shyam.
  4. Oracle Trigger
    Hi all, I am haritha. I want to write a trigger in Oracle for the following case. I have two domains and i have an employee table in both domains. I want to update the table when other table is updated. Thanks in advance.
  5. Triggers
    I need to write insert/update/delete Triggers on a number of tables. To save on maintenance, can I get the Trigger to call a Procedure passing down the :new and :old data set. I now I can pass idividual fields, but I want the whole record. These Triggers are for auditing ...
  6. Triggers
    Can someone explain what happens when a trigger is fired off (row level) repetitively? For instance, say my trigger fired when I insert on table A. If I insert many rows in a short amount of time and the trigger code takes a few seconds each to execute, what happens to the r...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: wasabi3689Posted on 2009-01-07 at 09:44:23ID: 23317267

here is what I did but it doesn't work I created when-list-changed trigger with the following code


IF (:media_request_info.status = 'IN_PROGRESS') THEN
       MESSAGE('The request is in procgress and you cannot change.');
       RAISE FORM_TRIGGER_FAILURE;

  ELSIF (:media_request_info.status = 'CANCELED') THEN
       MESSAGE('The request has been canceled and you cannot change.');
       RAISE FORM_TRIGGER_FAILURE;

  ELSIF (:media_request_info.status = 'REQUESTED') THEN
--the following will be a update query to make field value from requested to canceled only allowed
       MESSAGE('are you sure you want to change.');
      ....
   
 END IF;

 

by: wasabi3689Posted on 2009-01-07 at 09:50:07ID: 23317344

I don't understand why

When I change the status from requested to canceled, the tool bar comes up a message

frm-40200:field is protected against update

 

by: flow01Posted on 2009-01-07 at 10:03:11ID: 23317504

Are the properties of  the list-item regarding change (insert, update, delete) correct ?

 

by: wasabi3689Posted on 2009-01-07 at 10:05:31ID: 23317524

Yes

 

by: wasabi3689Posted on 2009-01-07 at 11:22:12ID: 23318369

any ideas?

 

by: flow01Posted on 2009-01-07 at 12:10:24ID: 23318850

ad ,acknowledge to your messages
add MESSAGE('end of when-list-changed',acknowledge);
at the end of your trigger

You can verify i if the trigger is entered.

 

by: wasabi3689Posted on 2009-01-07 at 12:20:07ID: 23318955

the too bar still saying "frm-40200:field is protected against update"

I add MESSAGE('end of when-list-changed',acknowledge); to the end of my code

....

  ELSIF (:media_request_info.status = 'REQUESTED') THEN
       MESSAGE('Are you sure you want to change the status?.');
     
   
 END IF;

MESSAGE('end of when-list-changed',acknowledge);

 

by: HenkaPosted on 2009-01-07 at 22:32:19ID: 23322621

Are block properties - insert_allowed, update_allowed set to property_true, too ?

 

by: flow01Posted on 2009-01-08 at 03:56:05ID: 23324044

Are there any on-error or on-message triggers in the form ?

If not so
add 2 triggers
on-error
on_message
on formslevel  with

message(:system.trigger_item || ':' || error_text || message_text);pause;

to check wath item causes de message

Remove the triggers afterwards !!

 

by: wasabi3689Posted on 2009-01-08 at 11:50:00ID: 23329313

Are block properties - insert_allowed, update_allowed set to property_true, too ?

Yes, they set all true.

I don't see "on formslevel" trigger.
But I add on-error, on_message with
message(:system.trigger_item || ':' || error_text || message_text);pause;

When I change status from requested to canceled,

first it pop up the message "Please acknowledge", in the tool bar it shows

MEDIA_REQUEST_INFO.STATUS:Field is protected against update.Field is protected against update

When I remove message code instead putting "null;" into on-error and on-message, and change status from requested to canceled, I don't see any pup-up message and message in the tool bar.
So far the triggers for my media_request_info block are only on-error and on-message,
It seems I need key-commit, pre-insert, pre-update, pre-query, post-query... right?

 

by: wasabi3689Posted on 2009-01-08 at 11:51:56ID: 23329337

I want the users can change the data for the media_request_info form and save it.

 

by: wasabi3689Posted on 2009-01-08 at 12:09:08ID: 23329562

maybe I need an on-update trigger? Also, I have create LOVs and record group for status. Do I need to do that? So far, it's pop up correctly when I click on the button and open the media request info form.

 

by: wasabi3689Posted on 2009-01-08 at 14:04:42ID: 23330745

please provide input/ideas, I need this very soon. Thanks

 

by: HenkaPosted on 2009-01-08 at 22:23:20ID: 23333210

"I don't see "on formslevel" trigger" - the triggers can be created
1) on forms level -> work for all form
2) on block level -> work for block
3) on item level -> work for item

I think that the primary problem is "MEDIA_REQUEST_INFO.STATUS:Field is protected against update" and it must be corrected.

It seems that somewhere the update_allowed property has been changed.

I would try to put this in the beginning of when-list-changed trigger:
message(Get_Item_Property(:system.trigger_block,update_allowed));
pause;
message(Get_Item_Property(:system.trigger_item,update_allowed));
pause;
to see if update is allowed or no.

 

by: flow01Posted on 2009-01-08 at 23:47:30ID: 23333481

since the 'end of when-list-changed' does not appear the when-list_changed triggers seams not to get hit.

Add the same code  to the on_error trigger.

 

by: wasabi3689Posted on 2009-01-09 at 08:19:06ID: 23337028


Henka:
I put your code in the beginning of when-list-changed trigger

It's still the same

first it pop up the message "Please acknowledge", in the tool bar it shows

MEDIA_REQUEST_INFO.STATUS:Field is protected against update.Field is protected against update

flow01:

I put
message(:system.trigger_item || ':' || error_text || message_text);pause;
to on_error trigger on the form level.

It's still the same as above


I see a pop-up the message "Please acknowledge"

 

by: flow01Posted on 2009-01-09 at 08:36:45ID: 23337249

I meant put the code of Henka

message(Get_Item_Property(:system.trigger_block,update_allowed));
pause;
message(Get_Item_Property(:system.trigger_item,update_allowed));
pause;

also in your on error trigger

 

by: wasabi3689Posted on 2009-01-09 at 08:46:35ID: 23337363

The tool bar show "TRUE" and pop up "Please acknowledge"

 

by: flow01Posted on 2009-01-09 at 09:13:54ID: 23337722

Did it show twice ?

add also
message(Get_Item_Property(:system.trigger_block,insert_allowed));
pause;
message(Get_Item_Property(:system.trigger_item,insert_allowed));
pause;

Check also for the property  "update if null"

double-check the properties of item
MEDIA_REQUEST_INFO.STATUS
and of block MEDIA_REQUEST_INFO

check the item-property "Query Only"
 
There must be someting

 

by: wasabi3689Posted on 2009-01-09 at 09:16:31ID: 23337755

Hi all,

I just find out something that may help you provide fix for me.

When I try to edit other fields such as ship_method, the tool bar comes up the following message

media_request_info.ship_method:cannot insert or update data in a view.cannot insert into or update data in a view

and pup-up a message "Please acknewledge". When I click OK, the tool bar displayed another message

fm-41045:Cannot find item:invalid ID

Yes, for block media_request_info's base table is a view.

How to fix this?

 

by: wasabi3689Posted on 2009-01-09 at 09:42:58ID: 23338055

Did it show twice ?

Yes

add also
message(Get_Item_Property(:system.trigger_block,insert_allowed));
pause;
message(Get_Item_Property(:system.trigger_item,insert_allowed));
pause;

First the toolbar displayed fm-41045:Cannot find item:invalid ID and pop-up"Please acknowledge". after click OK, again fm-41045:Cannot find item:invalid ID and pop-up"Please acknowledge"


Check also for the property  "update if null"

Where is it? I don't find it

double-check the properties of item
MEDIA_REQUEST_INFO.STATUS
and of block MEDIA_REQUEST_INFO

check the item-property "Query Only"

status item-property "Query Only"=fasle

I increase point value to 150, since this Q becoming more difficult now

 

by: flow01Posted on 2009-01-09 at 09:48:34ID: 23338134

Is the view based on 1 table ?
What version of oracle forms are u using ?

 

by: wasabi3689Posted on 2009-01-09 at 09:52:04ID: 23338178

the view has multiple tables. form version 11.0.0

 

by: flow01Posted on 2009-01-09 at 11:00:17ID: 23339020

Is suppose you want to change the status column of one the tables in the view

 2 options :
1)
create (in the database) an in-stead-of-trigger on de view that handles of the action to update the status
Then you can update a view with more tables (in sql or plsql).
But I don't remember if I used this feature also in a form : your message"cannot insert or update data in a view" is not promissing. For me the first possibilty to check is next monday.

2)
create a new item_list : status_update as a non_database_item
don't display your old item_list (make it also non-updatable)
in the post-query of the block make :status_update := :status

If the item-list is the only means of changing the status_update
add an update-statement in your item_list_changed trigger
update ...
set status = :status_update
where id = :id   (id must be 1 or more columns in your block that uniq identify the record)
because the oracle-forms block hasn't changed in a database-related field there might be no action
when you hit commit (check).
In that case (no action) you have to create an 'on-key-commit'-trigger that fires a commit serverside.
FORMS_DDL('COMMIT');  -- Commit in the database independent of the form

You wil loose oracle forms behaviour like messaging 'Nothing to change' when you hit the commit and nothing has changed.
Because of these changes you know can't  thrust on default oracle forms behaviour so you have to test your form very good.

 

by: wasabi3689Posted on 2009-01-09 at 11:23:22ID: 23339281

The users can change the data on the media_request_info form, not only the status field, but also they can update others fields such as ship_method...

 

by: wasabi3689Posted on 2009-01-09 at 13:29:09ID: 23340401

I am trying 2) option. Here is what I put

create a new item_list : status_update as a non_database_item

--I created a new item status_update under media_request_block

don't display your old item_list (make it also non-updatable)

--I don't understand this point, I have status list item on the media_request_info block

in the post-query of the block make :status_update := :status

--I add a  post-query trigger under media_request_block and put the the following code in this trigger
--:status_update := :status



If the item-list is the only means of changing the status_update

--Which list item? status_update or status?

add an update-statement in your item_list_changed trigger


--I added the following code to the status item list_changed trigger in media_request_info


update xx_upgrade_input_details xuid
         set status = :status_update
          where inventory_item_id = :licensed_products.inventory_item_id;

I cannot created the form

Compiling POST-QUERY trigger on MEDIA_REQUEST_INFO block...
Compilation error on POST-QUERY trigger on MEDIA_REQUEST_INFO block:
PL/SQL ERROR 49 at line 1, column 19
bad bind variable 'status'
PL/SQL ERROR 103 at line 2, column 1
Encountered the symbol "END" when expecting one of the following:
 "." "(" "*" "%" "&" "=" "-" "+" ";" "<" "/" ">" "in" "mod"
    "not" "rem" "an exponent (**)" "<> or != or ~=" ">=" "<="
    <> "and" "or" "like" "between" "is null" "is not" "||"
    "indicator"
; was inserted before "END" to continue.


Any thing wrong I did above?

 

by: flow01Posted on 2009-01-10 at 05:34:46ID: 23343665

The strategy is fetch your data by the view , update on separate columns.
MEDIA_REQUEST_INFO.STATUS is a data_base item and meant for  fetching the status in your block (did you keep it ?)
MEDIA_REQUEST_INFO.STATUS_UPDATE is not a data_base item and will be emty if you query your media_request_info.
Bij copying the data from STATUS to STATUS_UPDATE in the POST-QUERY you can show the status.
Updating  STATUS_UPDATE does not result in a update of MEDIA_REQUEST_INFO (so there is no problem with the view).
When you change STATUS_UPDATE , you will have to code your own update statement.

About your compilation errors : dont forget the ; after :status;
MEDIA_REQUEST_INFO.STATUS must exists , but set display no or don't assign a canvas:
your status has to be visible and updateble by STATUS_UPDATE.

I wil also check next monday on possibilty 3)
Fetching and updating by procedures;

 

by: flow01Posted on 2009-01-12 at 02:21:23ID: 23352108

Update
I did not use the instead_trigger on a view in combination with updating in a oracle-form.
There is no experience by me or my collegues  in using procedures for updating in forms.
So I can't advice further in the mentioned possibilities 1) and 3).

There is an interessing article in
http://www.dulcian.com/papers/ODTUG/2000/What-Do-You-Base-Your-Block-On.htm
but it states only to be used by an experienced developer.


 

 

by: wasabi3689Posted on 2009-01-13 at 14:55:50ID: 23368262

I am trying your option 2). But I still cannot create the form.

Compiling POST-QUERY trigger on MEDIA_REQUEST_INFO block...
Compilation error on POST-QUERY trigger on MEDIA_REQUEST_INFO block:
PL/SQL ERROR 303 at line 1, column 1
qualifier 'MEDIA_REQUEST_INFO' must be declared
PL/SQL ERROR 0 at line 1, column 1
Statement ignored



 In the post-query under media_request_info block, I put the following statement

media_request_info.status_update := :media_request_info.status;

 

by: HenkaPosted on 2009-01-13 at 21:52:01ID: 23370305

There is missing ":" in the beginning of the line there:

:media_request_info.status_update := :media_request_info.status;

 

by: wasabi3689Posted on 2009-01-14 at 09:25:24ID: 23375086

Should I need to define update_status?

I have


FRM-30351: Warning! No list elements defined for list item.
List STATUS_UPDATE

But I can create the form.

 

by: wasabi3689Posted on 2009-01-14 at 09:41:33ID: 23375254

When I open the media_request_form, I don't see the data and the toolbar show up the error message fm-41045:Cannot find item:invalid ID

 

by: HenkaPosted on 2009-01-14 at 22:51:03ID: 23381089

Is this an item
status_update in block media_request_info ?
It seems that you want to change the status of record programmatically.
If you want to test or set record status, then you ought to use
Get_Record_Property() built-in -> for testing
Set_Record_Property() built-in -> for setting
In the on-line help you can read more about these built-ins.

 

by: wasabi3689Posted on 2009-01-27 at 14:32:17ID: 23481918

I have made something working now. I can save the changes whenever I made to the field. But, the list trigger still cannot function for what I want. When I change the list item from "in_progress" to "requested", it allows me to do that although it pops up message, but I can still save it. It shouldn't allow me to save it. In my when-list-changed trigger, I have the following code.

For example, when users change "in_progress" to something else like "requested", the message will be shown but also, the form should stop and cannot allow them to save.

To cancel a record, simply changed Requested to Cancelled. This is only allowed for records with a status of Requested. An error message will be given if attempted
for other statuses.

the status in "requested" changed to "in_progress" should be allowed

Please continue to help. Thanks


 
IF (:media_request_info.status = 'IN_PROGRESS') THEN
       MESSAGE('The request is in procgress status and you cannot change.');
       RAISE FORM_TRIGGER_FAILURE; 
 
  ELSIF (:media_request_info.status = 'CANCELED') THEN
       MESSAGE('The request has been canceled and you cannot change.');
       RAISE FORM_TRIGGER_FAILURE; 
 
  ELSIF (:media_request_info.status = 'REQUESTED') THEN
       MESSAGE('The request has been requested and you can only be changed to Canceled.');
       RAISE FORM_TRIGGER_FAILURE; 
   
 END IF;

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:

Select allOpen in new window

 

by: HenkaPosted on 2009-01-28 at 00:42:42ID: 23484519

If you want stop the form and not allow saving then you ought to put testing
:media_request_info.status
in places where you want to save changes.
Also
IF (:media_request_info.status = 'IN_PROGRESS') THEN
       MESSAGE('The request is in procgress status and you cannot change.');
-- here you can disable save button
       RAISE FORM_TRIGGER_FAILURE;
 
  ELSIF (:media_request_info.status = 'CANCELED') THEN
       MESSAGE('The request has been canceled and you cannot change.');
-- here you can disable save button
       RAISE FORM_TRIGGER_FAILURE;
 
  ELSIF (:media_request_info.status = 'REQUESTED') THEN
       MESSAGE('The request has been requested and you can only be changed to Canceled.');
-- here you can set properties of those items you don't want allow users to change
       RAISE FORM_TRIGGER_FAILURE;
   
 END IF;

 

by: wasabi3689Posted on 2009-01-28 at 06:13:03ID: 23486565

-- here you can disable save button

how to do?

 

by: HenkaPosted on 2009-01-28 at 06:17:58ID: 23486627

Set_Item_Property('your_save_button',enabled,property_false);

 

by: wasabi3689Posted on 2009-01-28 at 07:06:18ID: 23487166

I don't have a save button on the form. If I want to save a record, I just go to action->save from the toolbar.

 

by: wasabi3689Posted on 2009-01-28 at 07:31:25ID: 23487467

Also, there is only one situation that the list item can be changed.
That is,
When user change list item from "requested" to "canceled", this is allowed. If "requested" to "in_procgress", this is not allowed. How to say that in the procedure?

 

by: wasabi3689Posted on 2009-01-28 at 08:53:45ID: 23488433

any ideas? I need this solution ASAP.

 

by: HenkaPosted on 2009-01-28 at 22:52:00ID: 23494754

Menu can be disabled by using
Set_Menu_Item_Property('menu_item',enabled,property_false);

2) You must know the previous state - if it was "requested" and user want to change it to "in_progress" then can look like this:

IF (:media_request_info.status = 'IN_PROGRESS') THEN
  IF <previous_state>='REQUESTED' THEN
    MESSAGE('The request is in procgress status and you cannot change.');
    :media_request_info.status = 'REQUESTED'; -- set the previous value of item
    RAISE Form_Trigger_Failure;
  END IF;
  ELSIF (:media_request_info.status = 'CANCELED') THEN
       MESSAGE('The request has been canceled and you cannot change.');
-- here you can disable save button
       RAISE FORM_TRIGGER_FAILURE;
 
  ELSIF (:media_request_info.status = 'REQUESTED') THEN
       MESSAGE('The request has been requested and you can only be changed to Canceled.');
-- here you can set properties of those items you don't want allow users to change
       RAISE FORM_TRIGGER_FAILURE;
   
 END IF;
 <previous_state> can be parameter or variable (defined in a package specification) in your form.

 

by: wasabi3689Posted on 2009-02-03 at 15:11:10ID: 23543424

Before I remove some items, everything seems working. After I remove inventory_item_id on the media_request_info block, the list status can change whatever I want but with the following message

frm-40815:variable GLOBAL.status does not exist

If I add back the item - inventory_item_id to the block, everything seems working. I don't understand why. I don't need inventory_item_id on the block.

Here is my when-list-changed trigger code

Under block media-request_info, I have the following triggers
on-update
key-commit
pre-text-item
on-lock
post-change

Before I remove inventory_item_id, everything seems working. But, after I remove it, it comes up that error message and the status list doesn't following what I want.
Why?
How to fix it?


IF (:global.status = 'IN_PROGRESS') THEN
       :media_request_info.status := :global.status;
       MESSAGE('The media request is in progress status and you cannot allow to change the status.');
        set_item_property ('media_request_info.status', ENABLED, PROPERTY_FALSE);
        RAISE FORM_TRIGGER_FAILURE; 
 
  ELSIF (:global.status = 'CANCELED') THEN
       :media_request_info.status := :global.status;
       MESSAGE('The request has been canceled and you cannot allow to change the status.');
       set_item_property ('media_request_info.status', ENABLED, PROPERTY_FALSE);
       RAISE FORM_TRIGGER_FAILURE; 
 
  ELSIF (:global.status = 'REQUESTED') THEN
   IF :media_request_info.status = 'IN_PROGRESS' THEN
      :media_request_info.status := :global.status;
       MESSAGE('The media has been requested and you can only allow to change to canceled status.');
    ELSE
      --media_request_status_changed; 
	MESSAGE('The media has been requested to cancel.');
    END IF;
   
 END IF;

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Select allOpen in new window

 

by: HenkaPosted on 2009-02-03 at 22:15:39ID: 23545379

In a When-New-Form-Instance trigger you can put this:
Default_Value('REQUESTED', 'global.status');

 

by: wasabi3689Posted on 2009-02-12 at 14:04:54ID: 23627459

Hi, I put your code

Default_Value('REQUESTED', 'global.status'); in In a When-New-Form-Instance trigger

The list doesn't work.

After I put back the inventory_item_id to the Canvas, it works.

I don't know why?

 

by: HenkaPosted on 2009-02-12 at 23:40:04ID: 23630562

What does it mean "The list does't work" ?
This command
Default_Value('REQUESTED', 'global.status');
create and set item global.status to 'REQUESTED'.

It seems that there is a relation between inventory_item_id and global.status in your form there.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...