Construct a view ...

Hello to anyone who is reading this.
I have the following querry constructed and i have to make a view out of it.
SELECT distinct
  worker ,
  SUBSTR(rtrim(name),1,20) name ,
  tax_id,
  info_2,
  date_1 ,
  ROUND(SUM(pay),2) pay ,
  DECODE (info_2 ,'D', ROUND(SUM(pay) * 0.5,2), 0) pay_50,
  DECODE (info_2 ,'F', ROUND(SUM(pay) * 0.7,2), 0) pay_70
FROM VIEW_IZPL_IN_YEAR_1 b,  WORKERS m, WORKERS_DEP r
WHERE cat_1 IS NOT NULL
AND info_2       IS NOT NULL
AND r.worker_id             = m.worker_id
AND finish_date        =
  (SELECT MAX(finish_date)
  FROM WORKERS_DEP
  WHERE worker_id = r.worker_id
AND b.worker      = m.worker_id
AND b.month BETWEEN to_date('01012010','ddmmyyyy') AND to_date('31122010','ddmmyyyy')
GROUP BY worker ,
  name ,
  tax_id ,
  info_2 ,
  date_1
ORDER BY nameThe problem is with the 'month' ... it is in where condition fixed with some date-values...
I want to remove it from where condition so useer who will run this view would have a choice from
which time frame he will take the data.
Now i did the obvious and put 'month' into select statment ... because i use SUM function in it
i had to put 'month' in group by as well ... and here it obvious falls apart.
I get to many statments as a resoult of group by.
Anyone has perhaps a solution how to go around this?
Much apreciated!
Thank you!

What value is in your column month?
I assume it is datatype date. This means it can be a day including hours, minutes and seconds.
Since you want to group all dates for a single month, then you need to group by trunc(b.month) . Same goes for the select part.
Furthermore your DISTINCT keyword is wrong. it is not needed. if you get duplicate records without it, then find out WHY you get the duplicates. Or else your sum will sum up too much.
Edited by: Sven W. on Mar 26, 2012 2:24 PM

Similar Messages

  • Constructing a View into time dependant data

    1. I have a table with data like this:
    PersonID
    DateTime
    Temperature
    Pressure
    2. I want to build a view into this table so that it shows up as follows:
    PersonID    DateTime1            DateTime2             DateTime3         .....
    1                Pressure1              Pressure2                Pressure3        ......
    1                Temperature1        Temperature2          Tempearture3  .....
    2                :
    how would I do this?

    Below query will work above SQL 2005,
    --create table routineCheck(PersonID int, [datetime] datetime, Temperature int, Pressure int)
    --insert into routineCheck values
    --(1,'01/01/2014', 61, 55),
    --(2,'02/01/2014', 60, 52),
    --(1,'01/05/2014', 62, 53),
    --(3,'01/08/2014', 60, 55),
    --(1,'02/07/2014', 63, 54),
    --(2,'01/12/2014', 63, 55)
    declare @cols nvarchar(max)
    declare @stmt nvarchar(max)
    select @cols = isnull(@cols + ', ', '') + '[' + cast(T.[datetime] as varchar)+ ']' from (select distinct [datetime] from routineCheck) as T
    print @cols
    select @stmt = '
    select *
    from (select PersonID, [datetime], Temperature from routineCheck) as T
    pivot
    max(T.temperature)
    for T.[datetime] in (' + @cols + ')
    ) as P '
    select @stmt = @stmt + ' union all
    select *
    from (select PersonID, [datetime], Pressure from routineCheck) as T
    pivot
    max(T.pressure)
    for T.[datetime] in (' + @cols + ')
    ) as P1 order by PersonID'
    exec sp_executesql @stmt = @stmt
    Regards, RSingh

  • How to construct alias view (source) in Mapping Level

    Hi All,
    I have the following logic, in PL/SQL Code as follows:
    from source a, source b
    where a.PLKC = b.PLKC
    and a.PLDO = b.PLDO
    and a.PLDC = b.PLDC
    and a.PLLN = b.PLLN
    and b.PLAD > 0 )
    How can we implement same logic in Mapping level by using Joiner.
    Thanks in advance...

    Hi All,
    I have the following logic, in PL/SQL Code as follows:
    from source a, source b
    where a.PLKC = b.PLKC
    and a.PLDO = b.PLDO
    and a.PLDC = b.PLDC
    and a.PLLN = b.PLLN
    and b.PLAD > 0 )
    How can we implement same logic in Mapping level by using Joiner.
    Well just use joiner operator in mapping, and connect your source tables to input groups (let us say a and input group b) and than set your join condition as you have write it here:
    a.PLKC = b.PLKC
    and a.PLDO = b.PLDO
    and a.PLDC = b.PLDC
    and a.PLLN = b.PLLN
    and b.PLAD > 0

  • Function used in view definition is called multiple times

    I am trying to write a view that boils down to the following statement:
    SELECT val, val FROM (
    SELECT SYS_GUID() val
    FROM dual
    Against my expectation, this calls SYS_GUID() twice, resulting in two different values for val.
    I've written it here as inline view, but it must be a regular view in reality. Is there any way to construct this view so that SYS_GUID is called only once, even if the resulting value is then selected multiple times? Naively, I'd like to assign the result of SYS_GUID to a variable and then select the value of this variable. However, this does not seem possible in a view.
    New to Oracle PL/SQL. This works as expected in SQL Server T-SQL.
    Thanks for any help or insight you can provide.
    -- Brian

    brianberns wrote:
    WHERE ROWNUM = 1 fixed the problem, although I have no idea why. Thank you!It's an unofficial way of preventing view merging.
    The inline view in your original code is being eliminated and the query transformed to:
    SELECT SYS_GUID(),SYS_GUID()
    FROM dualIn some circumstances the optimiser couldn't do that if the inline view contains a predicate on the ROWNUM pseudocolumn so the transformation is disabled.
    However the official way of doing this is with the NO_MERGE hint so I would definitely use NO_MERGE if it works (which it seems to), in case the optimiser gets smarter and disables the ROWNUM workaround in a future release.

  • Counting items in a view

    Hi all,
    I have the following problem:
    I have a table containing document data, each document has a doc_id as a unique indentifier. Each document is assigned to a project via the column proj_code:
    CREATE TABLE DOCS
    DOC_ID NUMBER(22) NULL,
    PROJ_CODE VARCHAR2(10) NULL,
    In another table I have the project codes, project names and customer names. Each project has one customer assigned to it, there can be multiple projects per customer. Project code and project name are in a 1:1 relationship:
    CREATE TABLE PROJECT
    PROJ_CODE NUMBER(22) NULL,
    CUST_NAME VARCHAR2(30) NULL,
    PROJ_NAME VARCHAR2(30) NULL
    What I'm trying to do now is construct a view, that'll give me project code, project name, customer name and the count of documents, that have this project code. here's what I've come up with so far:
    select proj_code, count(doc_id) from
    (select project.proj_code, doc_id from project, docs where project.proj_code = docs.proj_code) group by proj_code;
    This has two problems: it does not show the projects, that have no documents. Also, if I add the other columns to the select clause, I get this error:
    ORA-00979: not a GROUP BY expression [SQL State=42000, DB Errorcode=979]
    Ideas, anyone?
    Thanks,
    Mike

    (+) is an Oracle specific way of signifying outer
    joins. Since 9i Oracle has supported the ANSI
    constructs LEFT OUTER and RIGHT OUTER, it's just that
    old dogs such as myself tend to use (+) out of sheer
    force of habit.I stick with the old syntax as to me left and right are totally confusing concepts when it comes to sets, and the new syntax is as verbose as anything you'd expect to be designed by a committee.
    The big advanatge of the ANSI
    version is that it also has FULL OUTER, which was
    rather inconvenient to do in the earlier versions of
    Oracle.Agreed. Though I've only ever written precisely one full outer join, and seen one other.

  • Simple question on view but solution seems to be bit confusin plz help

    i want to construct a view on top of a table with a condition: I should not modify the view each time a new column is added to table.
    eg: table has
    empno ename address grade
    1 aaa US A
    2 bbb US c
    1 aaa US B
    2 ddd AUS B
    I want to create a view on top of the table selecting all columns and grade = A,B
    hence i get 3 rows in the view
    empno ename address grade
    1 aaa US A
    1 aaa US B
    2 ddd AUS B
    Now here lets concentrate on only two records
    1 aaa US A
    1 aaa US B
    I donot want to select both rows...coz the empno,ename,address are equal hence I will select only A i.e A has always more preference than B.
    my result should be containing only two rows
    1 aaa US A
    2 ddd AUS B
    Overall: i want to put a condition on grade (a,b) but i get two rows where rest of all columns have the same value i should select grade A row.
    how to write a query for this ? please let me know

    >
    empno ename address grade
    1 aaa US A
    2 bbb US c
    1 aaa US B
    2 ddd AUS B
    I want to create a view on top of the table selecting all columns and grade = A,B
    hence i get 3 rows in the view
    empno ename address grade
    1 aaa US AI'm confused here - do you want to get the best grade for
    each employee?
    If bbb's best grade is a C, why does it not get selected?
    1 aaa US B
    2 ddd AUS B
    SELECT *
    FROM YourTable
    WHERE grade = 'A' OR grade = 'B'
    Now here lets concentrate on only two records
    1 aaa US A
    1 aaa US B
    I donot want to select both rows...coz the empno,ename,address are equal hence I will select only A i.e A has always more preference than B.
    my result should be containing only two rows
    1 aaa US A
    2 ddd AUS B
    Overall: i want to put a condition on grade (a,b) but i get two rows where rest of all columns have the same value i should select grade A row.
    how to write a query for this ? please let me knowIn order to write a query, we have to understand exactly what it is you want.
    It seems to to me (correct me if I'm wrong) that you want a person's best grade,
    but only if that grade is an A or a B - is that basically it?
    Paul...

  • Including additional where clause conditions to view criteria dynamically

    Hi,
    We have a set of view objects that serves as LOV for various other view objects. All such LOV view objects have three specific attributes, two date attributes namely EffectiveStartDate, EffectiveEndDate and a String attribute namely UserSwitch based on which the LOV list needs to be filtered.
    All the view objects are having one or more view criterias with specific where clause conditions.
    Apart from those view criteria conditions, invariantly, we need the following conditions also
    :bindEffDate between EffectiveStartDate and EffectiveEndDate and UserSwitch = :bindUserSwitch.
    We wish not to include the above condition in each and every view criteria of each and every view object (Since we have around 800 view objects and a minimum of 2 view criterias per view object). Instead, we created a dummy view object (BaseViewObject) with two bind variables :bindEffDate and :bindUserSwitch and all the LOV view objects were made to extend this BaseViewObject.
    Therefore, whenever a view object atribute is attached with LOV using the above said LOV View Objects, the bind variables of the baseViewObject as well as the view object specific bind variables are available in the view accessors tab of the view object wizard where we can supply values to those bind variables.
    Now, we need to construct the view criteria filter clause. To achieve this, we created a class, CustomCriteriaAdapter.java extending oracle.jbo.server.CriteriaAdapterImpl. In the getCriteriaClause() method, we included the follwoing code:
    public String getCriteriaClause(ViewCriteria pViewCriteria)
    ViewObject vo = pViewCriteria.getViewObject();
    String userSelectSwitch = (String) vo.ensureVariableManager().getVariableValue("bindUserSwitch");
    String effBgnDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveStartDate")).getName();
    String effEndDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveEndDate")).getName();
    String customCriteria = " ( :bindEffDate >= " + effBgnDt + " ) AND ( :bindEffDate <= " + effEndDt + " OR " + effEndDt + " IS NULL ) ";
    StringBuffer completeCriteria = new StringBuffer();
    String criteriaClause = super.getCriteriaClause(pViewCriteria);
    if (criteriaClause != null && !criteriaClause.isEmpty())
    completeCriteria.append(criteriaClause + " AND ");
    completeCriteria.append(customCriteria);
    if (userSelectSwitch != null && "Y".equals(userSelectSwitch))
    String userSelectSw = vo.getAttributeDef(vo.getAttributeIndexOf("UserSwitch")).getName();
    completeCriteria.append(" AND (" + userSelectSw + "='Y' ) ");
    return completeCriteria.toString();
    Issues:
    The LOV list is not filtering the records based on the constructed conditions. Instead it is listing either all of the records considering only the view criteria conditions applied at design time irrespective of the userswitch and effectivedate conditions or the list is empty.
    Here, my questions are,
    1. Am I in the correct approach? If not, guide me in a more proper approach to achieve the same requirement.
    2. If the way I am trying is correct, where things are going wrong and why the dynamic condition is not getting effected?
    Kindly help in sorting out the issue.
    Thanks in advance.

    Hi Jobinesh,
    Thanks for your response and yes, we have done exactly as what you have mentioned. As explained earlier, a baseViewObject along with its Impl class has been created and it will be extended by all the viewobjects meant for serving LOV. Therefore, the superClass for any such LOV viewObject is the baseViewObjectImpl class. In that baseViewObjectImpl(), we have over-rided the criteriaAdapter() method and returned an instance of our customCriteriaAdapter() class.
    Below is the code we are using in the baseViewObjectImpl():
    package model.base.vo;
    import oracle.jbo.CriteriaAdapter;
    import oracle.jbo.server.ViewObjectImpl;
    public class BaseViewObjectImpl
    extends ViewObjectImpl
    * This is the default constructor (do not remove).
    public BaseViewObjectImpl()
    * Over-rided method of ViewObjectImpl class of the framework.
    * Calls the customized criteria adapter so that the default where clauses are added to the view criteria.
    * @return CriteriaAdapter.
    @Override
    public CriteriaAdapter getCriteriaAdapter()
    return new CustomCriteriaAdapter();
    I'll create a sample in HR schema and share with you shortly.
    Thanks and regards.

  • View on Tables

    Hello,
      How can i construct a view on the below tables..Please give me detailed steps
    HR Tables
    HRP1000
    HRP1001
    HRP1007
    HRP1011
    HRP1005
    Thanks

    BW,
      Check the below links. Step by step is given.
    http://help.sap.com/saphelp_470/helpdata/en/36/74c0358373003ee10000009b38f839/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/36/74c0358373003ee10000009b38f839/frameset.htm

  • How to grab the view that comes from Onyx?

    Hello,
      i started using Onyx project recently. That's really amazing what it does. I am wondering if there is some possibility to check the main view ... let my try to explain this.
    I want to change option for esxi5 box - advanced/Logging to external syslog server.
    While in gui i did my steps and Onyx prints the output:
    # ------- UpdateOptions -------
    $changedValue = New-Object VMware.Vim.OptionValue[] (1)
    $changedValue[0] = New-Object VMware.Vim.OptionValue
    $changedValue[0].key = "Syslog.global.logHost"
    $changedValue[0].value = "tcp://x.x.x.x:514"
    $_this = Get-View -Id 'OptionManager-EsxHostAdvSettings-456'
    $_this.UpdateOptions($changedValue)
    This is working as expected. I can throw this to powercli and it will set up the option. This will work only for that particular esxi box. I want to create a loop that will change this option for each esxi box in the cluster.
    The view that onyx is using is : "Get-View -Id 'OptionManager-EsxHostAdvSettings-456'"
    So he already knows the view/host moref .
    But if i would like to have this in a loop so it will do it for each host, so  how can i get to that kind of view ?
    So far i could only build something like
    foreach($vmhostview in (get-view -viewtype HostSystem -Searchroot (get-cluster "xxyyzz").id))
    $changedValue = New-Object VMware.Vim.OptionValue[] (1)
    $changedValue[0] = New-Object VMware.Vim.OptionValue
    $changedValue[0].key = "Syslog.global.logHost"
    $changedValue[0].value = "tcp://x.x.x.x:514"
    $number=$vmhostview.moref.split("-")[1]
    $_this = Get-View -Id OptionManager-EsxHostAdvSettings-$number
    $_this.UpdateOptions($changedValue)
    Which is totally stupid approach i belive although it's working.. splitting moref...
    After some time i noticed that
    http://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/vim.option.OptionManager.html
    Says that OptionManager is the property from Config manager. So from that i could get the id of this view:
    ((get-vmhost myHost |get-view).ConfigManager.AdvancedOption).ToString()
    which will result in output : OptionManager-EsxHostAdvSettings-456
    So having this i could do my loop at the end:
    foreach($vmhostview in (get-view -viewtype HostSystem -Searchroot (get-cluster "xxyyzz").id))
    $changedValue = New-Object VMware.Vim.OptionValue[] (1)
    $changedValue[0] = New-Object VMware.Vim.OptionValue
    $changedValue[0].key = "Syslog.global.logHost"
    $changedValue[0].value = "tcp://x.x.x.x:514"
    $_this = Get-View -Id ($vmhostview.ConfigManager.AdvancedOption).ToString()
    $_this.UpdateOptions($changedValue)
    Now i do not know that it was just a luck that i found the location of this view name or is this the way how i am supposed to find the view id name. I am wondering how other people are handling that kind of case, if there is easier way to do it. If someone could share his experience i would really appreciate it.
    Regards,
    Greg

    There is no need to construct these View-Ids as you see them coming from Onyx.
    In fact I would write that script like this
    $changedValue = New-Object VMware.Vim.OptionValue[] (1)
    $changedValue[0] = New-Object VMware.Vim.OptionValue
    $changedValue[0].key = "Syslog.global.logHost"
    $changedValue[0].value = "tcp://x.x.x.x:514"
    Get-View -ViewType HostSystem -Searchroot (Get-Cluster "xxyyzz").ExtensionData.MoRef | %{
      $optMgr = Get-View $_.ConfigManager.AdvancedOption
      $optMgr.UpdateOptions($changedValue)
    Move the part that doesn't change with each HostSystem outside the loop
    The ConfigManager is an array with MoRefs that point to the respective Managers. You can just do a Get-View with a MoRef and it will return the object representing the Manager
    From the Manager object you can now call the method
    Btw, you better consult the latest SDK Reference.
    You can find the HostConfigManager here.

  • Multiple views all using keyNavBeh

    Hi,
    I have four views of my world and I want to navigate around it seperatly in the different views. I have tried to give the canvas's focus (canvas.requstFocus()) and the JPannel they are in focus but every time i move, all the views change. Is then any way to stop all behaviours firing unless I want them to (short of writing a new class with flags to tell it when it should do something).
    Cheers
    Nodrog

    I created four canvas3D's and used this for the views;
    public BranchGroup createViewBranchGraph(Canvas3D c, Point3d eye, Point3d center, Vector3d up) {
    // Create a view object.
    View v = new View();
    // Create a ViewPlatform object.
    ViewPlatform vp = new ViewPlatform();
    // Create a PhysicalBody object.
    PhysicalBody pb = new PhysicalBody();
    // Create a PhysicalEnvironment object.
    PhysicalEnvironment pe = new PhysicalEnvironment();
    // Attach ViewPlatform, PhysicalBody, PhysicalEnvironment, and Canvas3D objects to View object.
    v.attachViewPlatform(vp);
    v.setPhysicalBody(pb);
    v.setPhysicalEnvironment(pe);
    v.addCanvas3D(c);
    v.setBackClipDistance(100);
    // Now, construct the view branch graph.
    BranchGroup bg = new BranchGroup();
    Transform3D trans3D = new Transform3D();
    trans3D.lookAt(eye, center, up);
    trans3D.invert();
    TransformGroup tg = new TransformGroup(trans3D);
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(tg);
    keyNavBeh.setSchedulingBounds(new BoundingSphere(new Point3d(), 100.0));
    bg.addChild(keyNavBeh);
    bg.addChild(tg);
    tg.addChild(vp);
    // Return the BranchGroup.
    return bg;
    Then;
    public Canvas3D getCanvas(Point3d eye, Point3d center, Vector3d up) {
    // Create a Canvas3D object.
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    Canvas3D can = new Canvas3D(config);
    // Construct a view branch graph.
    BranchGroup view = createViewBranchGraph(can,eye,center,up);
    //Add view to locale
    locale.addBranchGraph(view);
         return can;
    locale is a global Locale which has my scene graph added to it
    Hope this helps

  • JTextPane and views hierarchy

    I want to implement additional styles to paragraphs. For example I want to surround paragraph box with border. I've extended paragraph view and override paint method. Is something missing? The result of this overriding doesn't satisfy my.
    May someone write a tutorial about view architecture in text components? There is a pretty few articles in this forum and in the net about it and the issue is quite complex.
    Here I put my code:
    import java.awt.*;
    import javax.swing.SizeRequirements;
    import javax.swing.border.Border;
    import javax.swing.text.*;
    * View of paragraph that support borders and background color of the box.
    * @author Adam Doma�ski
    * @version 0.1 28/06/2003
    public class ImprovedParagraphView extends AdvancedParagraphView
          * Constructs the view for element.
          * @param elem Element.
         public ImprovedParagraphView(Element elem)
              super(elem);
         /* ----- Atrybuty ----- */
          * Gets the paragraph background color of view.
          * @return Color of paragraph background.
         public Color getParagraphBackground()
              AttributeSet attr = getAttributes();
              return AdvancedStyleConstants.getParagraphBackground(attr);
          * Gets the border around a paragraph.
          * @return Border around a paragraph.
         public Border getBorder()
              AttributeSet attr = getAttributes();
              return AdvancedStyleConstants.getBorder(attr);
         /* ----- View ----- */
          * Paints the view with background color and border.
          * @param g Device context.
          * @param a Shape of drawn surface.
         public void paint(Graphics g, Shape a)
              Rectangle r = a.getBounds();
              Border border = getBorder();
              border.paintBorder(null, g, r.x, r.y, r.width, r.height);
              Insets insets = border.getBorderInsets(null);
              r.x += insets.left;
              r.y += insets.top;
              r.width -= insets.left + insets.right;
              r.height -= insets.top + insets.bottom;
              //System.out.println(r + " " + a.getBounds());
              g.setColor(getParagraphBackground());
              g.fillRect(r.x, r.y, r.width, r.height);
              super.paint(g, r);
         protected short getBottomInset()
              Insets in = getBorder().getBorderInsets(null);
              return (short) (super.getBottomInset() + in.bottom);
         protected short getTopInset()
              Insets in = getBorder().getBorderInsets(null);
              return (short) (super.getTopInset() + in.top);
         protected short getRightInset()
              Insets in = getBorder().getBorderInsets(null);
              return (short) (super.getRightInset() + in.right);
         protected short getLeftInset()
              Insets in = getBorder().getBorderInsets(null);
              return (short) (super.getLeftInset() + in.left);
    }Thanks.

    Hi
    I am facing the same problem with my application,i am using the JEditorPane for HTML4.0 support,i also need to draw something like a titled border around the paragraph view but i don't know how to go about it.i see that u have extended the StyleConstants to get the border,could u guide me how to go about that also
    thanks

  • How to Bind a Combo Box so that it retrieves and display content corresponding to the Id in a link table and populates itself with the data in the main table?

    I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
    1. Party (PartyId, Name)
    2. Case (CaseId, CaseNo)
    3. Petitioner (CaseId, PartyId) ............. Link Table
    I am completely new to .Net and to begin with I download Microsoft's sample application and
    following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
    with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
    And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
    users can choose one from the dropdown list to add or edit the petitioner.

    Hello Barry,
    Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
    the sample available at the link you supplied.
    To get the idea of the thing here is my code behind of a view vBoxPetitioner:
    <UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:v="clr-namespace:CCIS.View.Case"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    d:DesignWidth="300"
    d:DesignHeight="200">
    <UserControl.Resources>
    <DataTemplate DataType="{x:Type vm:vmPetitioner}">
    <v:vPetitioner Margin="0,2,0,0" />
    </DataTemplate>
    </UserControl.Resources>
    <Grid>
    <HeaderedContentControl>
    <HeaderedContentControl.Header>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
    <TextBlock Margin="2">
    <Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
    | <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
    </TextBlock>
    </StackPanel>
    </HeaderedContentControl.Header>
    <ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
    </HeaderedContentControl>
    </Grid>
    </UserControl>
    This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
    Here is the code of vmPetitioner, a ViewModel:
    Imports Microsoft.VisualBasic
    Imports System.Collections.ObjectModel
    Imports System
    Imports CCIS.Model.Party
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' ViewModel of an individual Email
    ''' </summary>
    Public Class vmPetitioner
    Inherits vmParty
    ''' <summary>
    ''' The Email object backing this ViewModel
    ''' </summary>
    Private petitioner As tblParty
    ''' <summary>
    ''' Initializes a new instance of the EmailViewModel class.
    ''' </summary>
    ''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
    Public Sub New(ByVal detail As tblParty)
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Me.petitioner = detail
    End Sub
    ''' <summary>
    ''' Gets the underlying Email this ViewModel is based on
    ''' </summary>
    Public Overrides ReadOnly Property Model() As tblParty
    Get
    Return Me.petitioner
    End Get
    End Property
    ''' <summary>
    ''' Gets or sets the actual email address
    ''' </summary>
    Public Property fldPartyId() As String
    Get
    Return Me.petitioner.fldPartyId
    End Get
    Set(ByVal value As String)
    Me.petitioner.fldPartyId = value
    Me.OnPropertyChanged("fldPartyId")
    End Set
    End Property
    End Class
    End Namespace
    And below is the ViewMode vmParty which vmPetitioner Inherits:
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Collections.Generic
    Imports CCIS.Model.Case
    Imports CCIS.Model.Party
    Imports CCIS.ViewModel.Helpers
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' Common functionality for ViewModels of an individual ContactDetail
    ''' </summary>
    Public MustInherit Class vmParty
    Inherits ViewModelBase
    ''' <summary>
    ''' Gets the underlying ContactDetail this ViewModel is based on
    ''' </summary>
    Public MustOverride ReadOnly Property Model() As tblParty
    '''' <summary>
    '''' Gets the underlying ContactDetail this ViewModel is based on
    '''' </summary>
    'Public MustOverride ReadOnly Property Model() As tblAdvocate
    ''' <summary>
    ''' Gets or sets the name of this department
    ''' </summary>
    Public Property fldName() As String
    Get
    Return Me.Model.fldName
    End Get
    Set(ByVal value As String)
    Me.Model.fldName = value
    Me.OnPropertyChanged("fldName")
    End Set
    End Property
    ''' <summary>
    ''' Constructs a view model to represent the supplied ContactDetail
    ''' </summary>
    ''' <param name="detail">The detail to build a ViewModel for</param>
    ''' <returns>The constructed ViewModel, null if one can't be built</returns>
    Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Dim e As tblParty = TryCast(detail, tblParty)
    If e IsNot Nothing Then
    Return New vmPetitioner(e)
    End If
    Return Nothing
    End Function
    End Class
    End Namespace
    And final the code behind of the view vPetitioner:
    <UserControl x:Class="CCIS.View.Case.vPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    Width="300">
    <UserControl.Resources>
    <ResourceDictionary Source=".\CompactFormStyles.xaml" />
    </UserControl.Resources>
    <Grid>
    <Border Style="{StaticResource DetailBorder}">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="0" Text="Petitioner:" />
    <ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
    </Grid>
    </Border>
    </Grid>
    </UserControl>
    The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
    what I need to Know is how to route the binding path if it exists in a different ViewModel?
    Sir, I look forward to your early reply bringing a workable solution to the problem I face. 
    Warm Regards,
    Arun

  • Report/Form Please help

    Hi All,
    I need to know if there is a way to show a report with values from multiple tables that links to one form. I have limited experience and need the help.
    I have a table (table3 "ProCon") that links two separate tables (table1 "Project" and table2 "Contact") via a unique key. I want to be able to show project name and contact name for user to make sure they are editing correct account when linking over to PROCON table to update or create new. I get errors no matter what I try to do.
    This is our first application that we are trying to go live with and this is the only matter that is holding us up.
    Help would be extremely appreciated!!!

    Hi,
    with those different updates you can address different tables.
    Of course you have to store the correct primary keys as items and use them in the where clause of the update statement.
    The foreign key constraints will be automatically enforced....
    Using the procon linking table is the correct way to implement many-to-many relations in a relational database.
    If I look at your table schema, you have O -> C -> ProCon <- P <-SBIR
    which is correct from a modeling point of view!
    You can create a view which brings all the relevant infos together. About the issue of updateable views within Oracle, you should consult the manual ;-)
    If I am facing a similar problem within Apex, I do construct a view for a report which brings all the relevant info together. Within the report I make cells clickable with direction to a form then....
    This is maybe not as elegant, but I can use the built-in DML functions then.
    Regards
    Alex

  • How can I remove all messages, save to a DVD, and access them easily later?

    I recently dropped my .Mac account in order to use Gmail full time. I would like to be able to take those mac.com messages off of my computer--preferably saving them to a DVD--so that when I activate my Gmail account in Mail, they would be totally separate. I am also trying to save hard drive space.
    I've looked around about this, and even downloaded some Applescripts for Archiving mail, but those seem to continually make Mail crash (I have 3 years worth of email saved in Mail.app--about 3,000 emails). I have read enough about Backup to know that it saves things in strange/proprietary ways.
    Is the best plan simply to copy that ~/Library/Mail folder, straight up to a DVD, and then clear it off of my Mac? How do I do that without making Mail.app unstable? And will it be difficult to then read them from the DVD later if I need messages?

    ... and import its contents back into Mail whenever you wish ...
    You can also open individual .emlx message files within the copied mailboxes to read them, without first importing them back into Mail. However, by itself this isn't very practical because the files have names like "12345.emlx" that offer no clue about their content, so finding the message of interest among 3000 of them is a challenge.
    You might think that Spotlight would help with this, but in its normal state it excludes .emlx files from searches, so you can't simply do a Finder search on subject, content, etc. There are ways around this but none are simple:
    1. Use a Spotlight "raw query" search to find the messages. This avoids the exclusion of .emlx files that is tacked onto all normal Spotlight queries but requires knowledge of the syntax of raw queries. (To get an idea of how that looks, & to see the exclusions, you can do a "Get Info" on a Smart Folder. The raw query string is listed after the "Query:" entry in the General section.)
    2. Replace the ".emlx" extension with ".txt" or similar in the copied messages. (This could be done with an AppleScript using Finder.) Spotlight will then include the files in searches. In this case, opening the message file by default will be with TextEdit or similar, so you won't have access to "Reply" or similar features of Mail, but you will see the entire message, including the preference-like xml info about it that follows the message body in the raw .emlx file. As long as you don't alter the content, you can reimport the message into Mail by changing the extension back to ".emlx."
    3. Mimic what the Mail archive utilities do & construct a database that either relates the numbered .emlx files to their content or import entire files into database records & use its search features to find the messages of interest. This is appealing if you have a powerful database app like Filemaker & skills at database construction because you can construct any view of the info you want & organize it however you like. Obviously, if you don't, it would be simpler to buy a utility, which may offer other features that you might find useful.
    These alternatives would be most useful if you need to avoid reimporting large mailboxes back into Mail because of disk space concerns. They also avoid the perhaps considerable time it would take to reimport thousands of messages just to find one or two of interest. The second & third ones are somewhat self-contained & independent of Mail itself, which is both a strength & a weakness, depending on your needs.

  • Where clause with inner select ...

    I want to create a view similar to the following:
    CREATE VIEW VXRAY AS
    (SELECT a.modex, b.action_date
    FROM itac a, xray b
    WHERE a.item_id = b.item_id
    AND b.action_date =
    (SELECT max(c.action_date)
    FROM xray c
         WHERE c.item_id = b.item_id
    AND To_Char(c.action_date,'yymmdd') <= '980825'));
    Unfortunately, I cannot hardcode the date value as shown in the above example.
    So my question really is: "How can I construct the view without using a harcoded value ('980825' in above example)?".
    Since this view will be accessed by a reporting tool (Safari Reports), there will be no intelligence in the actual SQL query statement other than for example:
    "select * from vxray where item_id = 'IID001' and action_date <= '25 Aug 1998' "
    I've had some suggestions about using a "GROUP BY" function. (this doesn't work for me since the above example is just a very simplified version of what I'm selecting)
    I've also had suggestions about using the "&" paremeter prompt in the inner select (for the date value). Again, won't work (as mentioned earlier with the view being accessed from a Reporting Tool).
    If I had the following data in the 2 tables:
    ================ ==========================
    ITAC XRAY
    ================ ==========================
    ITEM_ID MODEX ITEM_ID ACTION_DATE
    IID001 1535 IID001 10-DEC-97
         IID001 24-AUG-98
    IID001 05-OCT-98
    SELECT * FROM vxray WHERE item_id = 'IID001' AND to_char(action_date,'yymmdd) <= '980825';
    MODEX ACTION_DATE
    1535 24 Aug 98

    Warren, thanx for the prompt reply ... unfortunately that won't work since the problem is not really accessing the view, but the SQL construction of the view itself.
    Here's what the real query looks like:
    CREATE VIEW vaaarpt AS (
    SELECT DISTINCT
    a.modex MODEX ,
    b.buno BEREAU_NUMBER ,
    b.action_date LATEST_ACTION_DATE,
    b.status_code STATUS_CODE ,
    b.model MODEL ,
    c.activity_code ACTIVITY_CODE ,
    c.curr_count CURR_COUNT ,
    d.item_id ITEM_ID ,
    d.sc SC ,
    (SELECT Sum(f.new_count)
    FROM vusage f
    WHERE f.interval_type = c.interval_type
    AND f.item_id = c.item_id
    AND f.end_datetime > b.action_date) FH_USAGE
    FROM itac a, xray b, act1 c, item d
    WHERE a.item_id = b.item_id
    AND b.item_id = c.item_id
    AND c.item_id = d.item_id
    AND b.action_date =
    (SELECT max (f.action_date)
    FROM xray f
    WHERE f.item_id = b.item_id
    AND To_Char(f.action_date,'yyyy/mm/dd') <= 'xxx') );
    Above view construction is incorrect since I don't have the value of xxx at the time when I defined the view.

Maybe you are looking for

  • Need help to develop CMDB using Apex

    Hi, We have a large number of servers, databases, environments, applications, etc for which we have planned to create a repository. Hence we need to develop a CMDB for the same. I have gone through the example tutorials related to Apex. However, I ha

  • Unable to pass security header

    Hi, We are facing issue while passing the OWSM policy from one proxy to other proxy. PS1 ->PS2 PS1 doesnot have OWSM policy . PS2 has owsm policy.The policy used is username token service policy. When we are calling the PS2 from PS1 the security head

  • Apple TV 1st generation heat

    Is it ok to leave Apple TV (1st generation) on stand by for several weeks or even months? I´m asking this because of the heat produced. Cheers.Apple

  • MovieClip width

    Not a first for this topic but other answers on the forum don't seem to work... I'm using MovieClips to do a fading "slideshow" using external jpgs. I'd like to center the jpgs on the Stage. I'm using a MovieClipLoader, creating a listener, and getti

  • Adobe CS6 is now a trial license of extended

    I have multiple end users at my company using various applications.  For the sake of this forum, one of the applications is Photoshop CS6 that was installed and licensed back in 2012.  All of a sudden, the user is getting a trial version of CS6 exten