DML on complex views

If I have a view based upon a join between two tables, does anyone know what the conditions are for inserting, updating or deleting data via the view are? (I'm using Oracle 8i)
Thanks.

you can execute the DML statements INSERT, UPDATE, and DELETE on a join view only provided that all of the following are true:
* The DML statement affects only one of the
tables underlying the join.
* If the statement is UPDATE, then all
columns updated are extracted from a key-
preserved table. In addition, if the view
has the CHECK OPTION, join columns and
columns taken from tables that are
referenced more than once in the view are
shielded from UPDATE.
* If the statement is DELETE, then there is
one and only one key-preserved table in
the join. This table may be present more
than once in the join, unless the view has
the CHECK OPTION.
* If the statement is INSERT, then all
columns into which values are inserted
come from a key-preserved table, and the
view does not have the CHECK OPTION.
HTH
Naresg
null

Similar Messages

  • Why we cannot perform DML operations against complex views directly.

    hi
    can any tell me why we cannot perform DML operations against complex views directly.

    Hi,
    It is not easy to perform DML operations on complex views which involve more than one table as said by vissu. The reason being you may not know which columns to be updated/inserted/deleted on the base tables of the views. If it is a simple view containing a single table it is as simple as performing actions on the table.
    For further details visit this
    http://www.orafaq.com/wiki/View
    cheers
    VT

  • Complex views can be updatable?

    I am having one complex view i need to update at run time for that view dipendent table. how can It possible

    from the free, online SQLmanual, the CREATE VIEW chapter, Notes on Creating Updatable Views
    An updatable view is one you can use to insert, update, or delete base table rows. You can create a view to be inherently updatable, or you can create an INSTEAD OF trigger on any view to make it updatable.
    To learn whether and in what ways the columns of an inherently updatable view can be modified, query the USER_UPDATABLE_COLUMNS data dictionary view. (The information displayed by this view is meaningful only for inherently updatable views.)
    If you want the view to be inherently updatable, it must not contain any of the following constructs:
    A set operator
    A DISTINCT operator
    An aggregate or analytic function
    A GROUP BY, ORDER BY, CONNECT BY, or START WITH clause
    A collection expression in a SELECT list
    A subquery in a SELECT list
    Joins (with some exceptions as described in the paragraphs that follow).
    In addition, if an inherently updatable view contains pseudocolumns or expressions, you cannot update base table rows with an UPDATE statement that refers to any of these pseudocolumns or expressions.
    If you want a join view to be updatable, all of the following conditions must be true:
    The DML statement must affect only one table underlying the join.
    For an INSERT statement, the view must not be created WITH CHECK OPTION, and all columns into which values are inserted must come from a key-preserved table. A key-preserved table in one for which every primary key or unique key value in the base table is also unique in the join view.
    For an UPDATE statement, all columns updated must be extracted from a key-preserved table. If the view was created WITH CHECK OPTION, join columns and columns taken from tables that are referenced more than once in the view must be shielded from UPDATE.
    For a DELETE statement, if the join results in more than one key-preserved table, then Oracle deletes from the first table named in the FROM clause, whether or not the view was created WITH CHECK OPTION.

  • Regarding  Complex View

    I have a complex view in which all not null columns selected in view query for the both table,
    No group function,pseudo column,distinct,group by clause,no columns defeined by expression,
    Whether we can do DML operation for this above criteia?

    From the document
    Updates of Object Views
    You can update, insert, and delete the data in an object view using the same SQL DML you use for object tables. Oracle updates the base tables of the object view if there is no ambiguity.
    A view is not updatable if its view query contains joins, set operators, aggregate functions, GROUP BY, or DISTINCT. If a view query contains pseudocolumns or expressions, the corresponding view columns are not updatable. Object views often involve joins.
    To overcome these obstacles Oracle provides INSTEAD OF triggers. They are called INSTEAD OF triggers because Oracle runs the trigger body instead of the actual DML statement.
    INSTEAD OF triggers provide a transparent way to update object views or relational views. You write the same SQL DML (INSERT, DELETE, and UPDATE) statements as for an object table. Oracle invokes the appropriate trigger instead of the SQL statement, and the actions specified in the trigger body take place.

  • How to update or delete records in a Complex View in Forms?

    Hi,
    I have a requirement to create a Form by using Complex View. Insertion is possible but updation and deletion is not working properly . I got FRM-40501 Error. I need How to update or delete records in a Complex View in Forms?
    Thanks & Regards,
    Hari Babu

    Depending on how complex your view is, forms is not able to determine how to appropiately lock a record, when you try to update or delete a record.
    One approach to using complex views in forms:
    1. Set the Key-mode of the block to "Non-Updateable"
    2. Mark the column which can be used to build the WHERE-condition to uniquely identify a record with "Primary Key" = "Yes"
    3. For doing INSERT, UPDATE and DELETE, create an INSTEAD-OF-trigger on the view.
    4. Create your own ON-LOCK-trigger in forms which does the locking of the records to update.

  • Updates to a complex view

    SQL Developer version 3.0.04 on XP Pro
    We are able to use the data grid to update the values of views that are inherently updatable, no problem.
    We have a complex view with an associated instead-of-update trigger. We are able to update this complex view using an UPDATE statement, no problem.
    We would like to be able to update the complex view using the data grid (just in case I am mixing up the terminology, by "data grid" I mean the interface you get when you select the view from the navigation pane and then click the "Data" tab), but the fields are read only.
    Is there a configuration option that we can use to enable this? Or, some sort of workaround? Or, are we simply not able to update complex views using the data grid?
    Thanks!
    -Tom

    i think u need to change ur application structurei don't think so. Create an INSTEAD-OF-trigger on your view and manage the splitting there. In forms, you wil have to set the property "Primary Key" for the pk-item's to "Yes" and eventually you have to create an ON-LOCK-trigger

  • Complex view in forms 6i

    i have create a complex view
    and i want to use this view in oracle form developer 6i
    when i try to insert a new record in the view i have this error message frm-40602
    in the database i have wire the instead of trigger
    so how can i use the form to insert anew record in this view

    not all columns can be updated by a view. Those columns, which are not allowed have to be set to "Query Only". try this property

  • Complex Views

    I'm trying to figure out how to build a complex view. Right now I have a textfield and button that are tied to a search function. I have a SearchController class that is tied to a SearchView.xib. The textfield and search button are for specific keyword searching
    I want to add a table view to this search view for canned searches by category. Should I create another controller just for this sub-part to the view or should I just implement the methods for a UITableViewController within the Search Controller?

    I understand that a UITableViewController is just a dummy interface. That's not exactly what I'm getting at...
    I do have my controllers separated into a SearchController and a ResultsController with different xib view files associated with each of them. What I'm struggling with is trying to add a UITableView to the search view which is owned by SearchController which is a UIViewController.
    It seems like it would be a bad idea to have two controllers, one referencing the larger part of a view and a subpart of that view being controlled by a second controller, so I'm trying to add a UITableView as a member variable of the SearchController and making the SearchController a UITableViewDelegate. I just want to make sure I'm approaching this problem with the best practices. Apple has provided some great examples about Table Views themselves, and other views, but there is no example out there that has multiple types of views in one given view.

  • Find all DMLs on a view

    Hi!
    I have following situation: I should check our source code for all places where exists INSERTs, UPDATEs,... etc. on one view and implement certain modifications. View name is AG. So to do that my query is:
    SELECT   owner "Owner", NAME "PL/SQL Object Name", TYPE "Type", line "Line",
             text "Text", owner sdev_link_owner, NAME sdev_link_name,
             TYPE sdev_link_type
        FROM SYS.all_source
       WHERE owner = USER
         AND INSTR(UPPER(text), UPPER('AG')) > 0
         AND NAME NOT LIKE 'BIN$%'
    ORDER BY owner, NAME, TYPE, line;Problem is that view name is very tricky and that I'm getting more then 2000 rows (places) where string AG appear. Mostly of this 2000 rows are appearances of sting AG in different context (part of object names, comments,....)
    So my question is does exist some shorter way to find all DMLs on this view except to check more then 2000 rows?

    Problem is that view name is very tricky and that I'm
    getting more then 2000 rows (places) where string AG
    appear. Mostly of this 2000 rows are appearances of
    sting AG in different context (part of object names,
    comments,....)PL/SQL code in all_source is stored one record per code line.
    SQL> desc all_source
    Name Null? Type
    OWNER VARCHAR2(30)
    NAME VARCHAR2(30)
    TYPE VARCHAR2(12)
    LINE NUMBER
    TEXT VARCHAR2(4000)
    SQL> create or replace function funct1(i number) return number
    2 is
    3 begin
    4 return(i+1);
    5 end;
    6 /
    Function created.
    SQL> select count(1) from all_source where NAME='FUNCT1';
    COUNT(1)
    5
    SQL> column text format a50
    SQL> select LINE, TEXT from all_source where NAME='FUNCT1';
    LINE TEXT
    1 function funct1(i number) return number
    2 is
    3 begin
    4 return(i+1);
    5 end;

  • How to insert new record or update existing record using a complex view?

    Currently I created this screen, there is no problems on display data, only on the update funtionality (it means insert / update / delete on the table for which the view is based on).
    I have a table and a complex view in order to display the information from the table in a tabellar form (i.e up to 70 record in same "record" in the form, one for each item)
    The view is like this
    select a.f1, a.f2, get_value(a.pk1,1) a1, get_value(a.pk1,2) a2, get_value(a.pk1,3) a3............
    from my_table a
    where a.proj_id = user
    and I want to permit the update of the field a1, a2, a3 in a multiposition canvas (tabellar).
    I created an INSTEAD-OF trigger.
    But it not work only in the form. I receive the error FRM-40654 when I try to change the existing value in the running form based on that view.
    The view is woking and updatable using sql-plus.
    If I query
    select * from ALL_UPDATABLE_COLUMNS where table_name = 'SPV_BOQ_BOM_POS_ACTIVITIES';
    in which 'SPV_BOQ_BOM_POS_ACTIVITIES' is the name of my view.
    The question is: why if the view is updatable using SQL*Plus, is not updatable using Oracle Form 10gR2 ?
    Someone could help me asap?
    Thanks

    I removed on the datablock three items that are not showed, one of this is the Sysdate of update on the table for which the view is based.
    I removed also the on-lock trigger and the update from the form is NOT working fine.
    But for now I can still mantaing the ON-LOCK trigger.
    Is not a priority to remove this trigger.
    I still have the problem when the field is null, it mean that in the table SP_BOQ_BOM_POS_ACTIVITIES the record not exist.
    I try now to explayn better.
    SPV_BOQ_BOM_POS_ACTIVITIES is the name of the view.
    SP_BOQ_BOM_POS_ACTIVITIES is the name of the table.
    This are the desc
    desc SPV_BOQ_BOM_POS_ACTIVITIES
    Describing SPV_BOQ_BOM_POS_ACTIVITIES....
    NAME Null? Type
    BOQ_HEADER_ID NOT NULL NUMBER(12,0)
    BB_ID NOT NULL NUMBER(12,0)
    BOQ_ID NOT NULL NUMBER(12,0)
    PROJ_ID NOT NULL VARCHAR2(10)
    ACT_GROUP_CODE VARCHAR2(30)
    TOTAL_QTY NUMBER
    ACT_CODE_1 VARCHAR2(4000)
    QTY_1 NUMBER
    ACT_CODE_2 VARCHAR2(4000)
    QTY_2 NUMBER
    ACT_CODE_3 VARCHAR2(4000)
    QTY_3 NUMBER
    ACT_CODE_4 VARCHAR2(4000)
    QTY_4 NUMBER
    ACT_CODE_5 VARCHAR2(4000)
    QTY_5 NUMBER
    ACT_CODE_6 VARCHAR2(4000)
    QTY_6 NUMBER
    USR_ID NOT NULL VARCHAR2(10)
    LMOD NOT NULL DATE
    INT_REV NOT NULL NUMBER(6,0)
    The field QTY_1, QTY_2.... QTY_6 are calculated with a customer stored function from the table SP_BOQ_BOM_POS_ACTIVITIES.
    Also the field ACT_CODE_1, ACT_CODE_2, .... ACT_CODE_6 are calculated with a customer stored function from the table SP_BOQ_BOM_POS_ACTIVITIES.
    desc SP_BOQ_BOM_POS_ACTIVITIES
    Describing SP_BOQ_BOM_POS_ACTIVITIES....
    NAME Null? Type
    BBPA_ID NOT NULL NUMBER(12,0)
    BOQ_HEADER_ID NOT NULL NUMBER(12,0)
    BB_ID NOT NULL NUMBER(12,0)
    BOQ_ID NOT NULL NUMBER(12,0)
    PROJ_ID NOT NULL VARCHAR2(10)
    ACT_GROUP_CODE NOT NULL VARCHAR2(30)
    ACT_CODE NOT NULL VARCHAR2(30)
    QTY NUMBER(12,0)
    FLG_MANUAL_CHANGE VARCHAR2(1)
    USR_ID NOT NULL VARCHAR2(10)
    LMOD NOT NULL DATE
    INT_REV NOT NULL NUMBER(6,0)
    If I use SQL Navigator this insert working fine
    insert into SPV_BOQ_BOM_POS_ACTIVITIES
    (BOQ_HEADER_ID, BB_ID, BOQ_ID, PROJ_ID, ACT_GROUP_CODE, ACT_CODE_1, QTY_1)
    values (5050, 5015, 30486, 'B39368', 'TEST', '0101010101010101', 1709)
    1 row(s) inserted
    Instead using the Screen, at runtime, I receive the message:
    FRM-40400 Transation Complete: 1 records applied and saved
    but nothing is saved in the table SP_BOQ_BOM_POS_ACTIVITIES, and the view SPV_BOQ_BOM_POS_ACTIVITIES contain the calculated QTY_1 for the 'key', with null value.
    Moreover If in the field QTY_1 (NUMBER) I put a character, instead a Number, just to see if the Screen attempts or not an UPDATE or AN INSERT, the message is FRM-40509: Oracle Error. UNABLE TO UPDATE RECORD. Why happen an Update and not an INSERT using the Screen?
    In effect, the trial using SQL navigator of the following statement
    insert into SPV_BOQ_BOM_POS_ACTIVITIES
    (BOQ_HEADER_ID, BB_ID, BOQ_ID, PROJ_ID, ACT_GROUP_CODE, ACT_CODE_1, QTY_1)
    values (5050, 5015, 30486, 'B39368', 'TEST', '0101010101010101', 'r');
    I got Invalid Number and it's ok as answer from the database.
    Edited by: fmariani on 30-apr-2009 1.51

  • Complex view update

    Dear All
    Pls guide me how to update a complex View
    Thanks for reading this post
    *009*

    Hi again,
    You probably need to write an [Instead-of-Trigger|http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/statements_7004.htm#i2064426]
    Regards
    Peter

  • Creating a complex view

    I Need to create a complex (at least for me !!)view can some body throw some ideas
    I have two tables
    TABLE-1
    NAME     SYSTEM          DT
    AAA     GRADE-A          DATE
    AAA     GRADE-B          DATE
    BBB     GRADE-A          DATE
    BBB     GRADE-B          DATE
    CCC     GRADE-B          DATE
    TABLE-2
    NAME     SYSTEM          DT
    DDD     GRADE-C          DATE
    AAA     GRADE-C          DATE
    BBB     GRADE-C          DATE
    CCC     GRADE-C          DATE
    Now I need to create a view with following details.
    PV_MYVIEW
    CLASS          DT
    CLASS-A          DATE-A
    CLASS-B          DATE-B
    Where as date DATE-A should be oldest date (least) from following
    Table-1.date where name=AAA And SYSTEM=GRADE-A
    Table-1.date where name=AAA And     SYSTEM=     GRADE-B
    Table-1.date where name=BBB And     SYSTEM=     GRADE-A
    Table-1.date where name=BBB And     SYSTEM=     GRADE-B
    Table-1.date where name=CCC And     SYSTEM=     GRADE-B
    Table-2.date where name=DDD And     SYSTEM=     GRADE-C
    Table-2.date where name=AAA And     SYSTEM=     GRADE-C
    Table-2.date where name=BBB And     SYSTEM=     GRADE-C
    Table-2.date where name=CCC And     SYSTEM=     GRADE-C
    Where as DATE-B should be oldest date (least) from following
    Table-1.date where name=AAA And     SYSTEM=     GRADE-A
    Table-1.date where name=AAA And     SYSTEM=     GRADE-B
    Table-1.date where name=BBB And     SYSTEM=     GRADE-A
    Table-1.date where name=BBB And     SYSTEM=     GRADE-B
    Table-2.date where name=AAA And     SYSTEM=     GRADE-C
    Table-2.date where name=BBB And     SYSTEM=     GRADE-C
    As a solution for this, I Am thinking of first creating a intermediate view which comsist
    Class, Name and Date and then from this view creating PV_MYVIEW..
    Am i in right direction?
    THanks in advnce for your time

    creating an intermediate view is the worst thing to do!
    try this
    select
    'CLASS-A' class, min(dt) DT
    from
    select DT from TABLE1
    where (name='AAA' And SYSTEM='GRADE-A')
    or (name='AAA' And SYSTEM='GRADE-B')
    or (name='BBB' And SYSTEM='GRADE-A')
    or (name='BBB' And SYSTEM='GRADE-B')
    or (name='CCC' And SYSTEM='GRADE-B')
    union all
    select DT from TABLE2
    where (name='AAA' And SYSTEM='GRADE-C')
    or (name='BBB' And SYSTEM='GRADE-C')
    or (name='CCC' And SYSTEM='GRADE-C')
    or (name='DDD' And SYSTEM='GRADE-C')
    union all
    select
    'CLASS-B', min(dt)
    from
    select DT from TABLE1
    where (name='AAA' And SYSTEM='GRADE-A')
    or (name='AAA' And SYSTEM='GRADE-B')
    or (name='BBB' And SYSTEM='GRADE-A')
    or (name='BBB' And SYSTEM='GRADE-B')
    union all
    select DT from TABLE2
    where (name='AAA' And SYSTEM='GRADE-C')
    or (name='BBB' And SYSTEM='GRADE-C')
    You can for sure remove some duplicate clause and you should verify that the specifications are accurate
    REgards
    Laurent

  • DML on materialized view

    Hi,
    I generated materialized view and will maintain data on it when I run delete statement that show below error
    ORA-01732: data manipulation operation not legal on this view
    So my question is How to maintain data on M View (delete old data)? because I need to keep data only 2 months but source table keep data 6 months.
    Regards,
    Hiko

    taohiko wrote:
    There have 8 tables but have only one table that have date/time column and others tables will use primary key from first table relate to data.
    And source tables have total records around 300 million records but I want 2 months that around 90 million records.
    So I plan to delete data every days that older than 2 months and delete others table with relation by primary from first table.
    Can I do? and How to do that?
    Regards,
    HikoHi,
    No you cannot delete the data from materialized view if the view is complex and does not statisfy some basic rules.
    Even if you satisfy some of the basic rules still the thing/expectation you have with your MV is not provided by Oracle. If you delete any data from MV, it would be deleted from base table also.
    Work around and a better implementation would be
    Just include in your create mv a where clause stating
    date/time column > trunc(sysdate)-60This would take care of all the other tables data also if they are joined with the main table.
    Regards
    Anurag

  • Complex View State handling

    Hi,
    I am trying to solve the following problem in Flex3:
    I have layout with 4 quadrants ["Ch" for Child component
    class]:
    Ch1 Ch2
    Ch3 Ch4
    If I click a button in ch4 [i.e. state ch4a], it is supposed
    to expand and cover Ch2, i.e.
    Ch1
    Ch4a
    Ch3
    Class Parent1 [inside Accordion]:
    VBox
    HBox1
    <view:Ch1 width="60%" />
    <view:Ch2 width="40%" />
    /HBox1
    HBox2
    <view:Ch3 width="60%" />
    <view:Ch4/>
    /HBox2
    /VBox
    So in class Ch4 I created a view stateA which is based on
    BaseState.
    A) What makes more sense, fire event in class Ch4 on that
    button click,
    capture it in Parent1 and somehow [how?] change a layout so
    that Ch2 is not there
    but twice higher Ch4a is instead of it and no second part in
    HBox2 ?
    I would guess, ActionScript instead of MXML or is there a way
    to express that in MXML?
    Or how should that ActionScript look like ?
    B) The other [easier] possibility is to get a handle to
    Parent1 [parent container]
    from the viewstateA of Ch4 and do something like:
    <SetProperty target={this.parent} name="y" value="0">
    Is it feasible? So far that didn't work for me. Any
    suggestions?
    Few other details:
    1) it's all in Cairngorm AIR app;
    2) that button in Ch4 is on one side a toggle button between
    view states,
    on the other side processing is completely different, but I
    can handle that through calling
    2 different private functions. I am saying only in one
    state[BaseState] that event should be fired.
    3) Background: Ch1 and Ch3 have lots of dropdowns, and what
    user selected would be displayed
    in Ch4A [that top portion], so user "Signs" that info, that's
    a point of the whole screen.
    Is there easy way to pass these selections to Ch4 ?
    As of now, it's all buried deep inside some complex obscure
    VOs .
    Any help is very appreciated.
    Thank you in advance,
    Oleg.

    The robot method is quite slow, and it can only capture images that are actually on the screen in the foreground. In any case, I stumbled on this article: [Performance Improvement Techniques for JavaFX Applications|http://javafx.com/docs/articles/performance/] that mentions the 'cache' member variable of a Node/Group can be used to tell the system to convert the Node to a bitmap (internally) for performance improvement. I haven't done any testing of my own, but it's an easy addition if you have a performance sensitive app.

  • Complex View navigation

    Hi Guys
    I've got a setup as follows:
    .........................mainview
    ...................... _____|______
    ...................... |...................|
    ....................view1.............view2
    ......... ________|________
    .........|.............|.............|
    defaultViewS viewS2 viewS3
    So Say I want to change from view2 to view1 all I would have to do is:
    ActionScript Code:
    <s:Button label="Change to default view state"
                click="currentState='view1';"/>
    and it would open view1 with the default view (defaultViewS)
    So the question is: How would I specify that instead of view opening to it's default state, how would I open it to it's non-default state(ie viewS2 or viewS3)
    Thanks

    Hi
    Thanks for your help! but it's not quite what I need. I'm using quite a complex method to navigate about my app and I attempted to simplify it to make it easier to explain.
    I'll explain my basic requirement and then I'll post my project compostion so you can see what I'm talking about.
    Basically I have a tabbar which contains 6 viewstates. Those 6 viewstates and not simple views but themselves contain multiple views.
    So if you click on tab button no 2 it will open tabButtonTwoView. tabButtonTwoView 3 views inside itself, when tabButtonTwoView is opened it opens to the default view. If you navigate away from tabButtonTwoView and return to it then you will see whichever view you were last looking at(it not neccesarily the default view)
    So basically what I would like is that say you are on tabButtonOneView and you have a button there, then clicking that button would open tabButtonTwoView and then the view that has been specified, not the view that it opens by default or the view that you had open last.
    Ok so that's the basic explanation. now I'll give you a breakdown of my project since it's a little bit more complex than that. I''ve also attached the project for you to have a look at.
    you can download it here ( -- code removed -- )
    So basically I'm using a MVCS methodology here along with robotlegs.
    here's the basic way the nav works.
    my main view contains these components:
    <view:HeaderView id="header"
    width="100%"
    />
    <view:MainTabBar id="someTabBar" />
    <view:ContentView id="content"/>
    <view:FooterView id="footer"
    width="100%"
    />
    Tab Bar controls the main navigation of content using a mediator class:
    package za.co.vw.projectname.view
    import mx.collections.ArrayCollection;
    import mx.events.StateChangeEvent;
    import org.robotlegs.mvcs.Mediator;
    import spark.events.IndexChangeEvent;
    import za.co.vw.projectname.event.NavigationEvent;
    public class MainTabBarMediator extends Mediator
    public function get view():MainTabBar
    return viewComponent as MainTabBar;
    override public function onRegister():void
    eventMap.mapListener(view, IndexChangeEvent.CHANGE, onSelectedIndexChange);
    eventMap.mapListener(eventDispatcher, StateChangeEvent.CURRENT_STATE_CHANGE, onStateChange);
    view.dataProvider = new ArrayCollection([{label:'About', name:'about'}, {label:'Apply', name:'apply'}, {label:'Date', name:'date'}, {label:'Watch', name:'watch'}, {label:'GTI', name:'gti'}]);
    private function onSelectedIndexChange(event:IndexChangeEvent):void
    if(!view.selectedItem)
    return;
    var navTo:String;
    trace(view)
    trace(view.selectedItem)
    trace(view.selectedItem.label)
    switch(view.selectedItem.label)
    case "About":
    navTo = NavigationEvent.ABOUT;
    break;
    case "Apply":
    navTo = NavigationEvent.APPLY;
    break;
    case "Date":
    navTo = NavigationEvent.DATE;
    break;
    case "Watch":
    navTo = NavigationEvent.WATCH;
    break;
    case "GTI":
    navTo = NavigationEvent.GTI;
    break;
    case "Home":
    navTo = NavigationEvent.HOME;
    break;
    dispatch(new NavigationEvent(NavigationEvent.VIEW_CHANGE, navTo));
    private function onStateChange(event:StateChangeEvent):void
    var s:String = event.newState.slice(0, event.newState.indexOf("State"));
    var tabItem:Object = getTabItemByName(s);
    if(s == "home")
    trace("going home");
    view.selectedIndex = -1;
    } else if(view.dataProvider.getItemIndex(tabItem) != view.selectedIndex)
    trace("not going home, changing to "+s);
    view.selectedItem = tabItem;
    private function getTabItemByName(name:String):Object
    for each(var obj:Object in view.dataProvider)
    if(obj.name == name)
    return obj;
    return null;
    which talks to and event class called NavigationEvent:
    package za.co.vw.projectname.event
    import flash.events.Event;
    public class NavigationEvent extends Event
    public static const VIEW_CHANGE:String = "viewChange";
    public static const ABOUT:String = "about";
    public static const APPLY:String = "apply";
    public static const DATE:String = "date";
    public static const WATCH:String = "watch";
    public static const GTI:String = "gti";
    public static const HOME:String = "home";
    public var targetViewId:String;
    public function NavigationEvent(type:String, targetViewId:String="", bubbles:Boolean=false, cancelable:Boolean=false)
    super(type, bubbles, cancelable);
    this.targetViewId = targetViewId;
    most of my other components have mediators which dispatch navigation events, all of this being registered and and executed by the robotlegs frame works. The connections to the classes and their mediators are made in the ViewPrepCommand class:
    package za.co.vw.projectname.controller
    import org.robotlegs.mvcs.Command;
    import spark.components.TabBar;
    import za.co.vw.projectname.view.AboutView;
    import za.co.vw.projectname.view.AboutViewMediator;
    import za.co.vw.projectname.view.ContentView;
    import za.co.vw.projectname.view.ContentViewMediator;
    import za.co.vw.projectname.view.DateView;
    import za.co.vw.projectname.view.DateViewMediator;
    import za.co.vw.projectname.view.HeaderView;
    import za.co.vw.projectname.view.HeaderViewMediator;
    import za.co.vw.projectname.view.MainTabBar;
    import za.co.vw.projectname.view.MainTabBarMediator;
    import za.co.vw.projectname.view.MainView;
    import za.co.vw.projectname.view.MainViewMediator;
    public class ViewPrepCommand extends Command
    override public function execute():void
    mediatorMap.mapView(HeaderView, HeaderViewMediator);
    mediatorMap.mapView(ContentView, ContentViewMediator);
    mediatorMap.mapView(MainView, MainViewMediator);
    mediatorMap.mapView(DateView, DateViewMediator);
    mediatorMap.mapView(AboutView, AboutViewMediator);
    mediatorMap.mapView(MainTabBar, MainTabBarMediator);

Maybe you are looking for