Complex situation

Hi All
I have the following scenario:
I have two tables DW_PS_AP_PO_RQ_FACT and DW_PS_AP_AP_ALL_PAYMENTS
In the DW_PS_AP_PO_RQ_FACT table i have a PO_AMOUNT AND PO_NUMBER fields and each PO_NUMBER has only one PO_AMOUNT, on the second table DW_PS_AP_AP_ALL_PAYMENTS, i have THREE fields PO_PAYMENT_AMOUNT,PO_NUMBER and INVOICE_DATE, In this table for each PO_NUMBER , they can have more than one PO_PAYMENT_AMOUNT fields associated. I uded the below dql to join these two tables:
SELECT t1.ps_no, t1.amount ytd_po_totals, t1.bud_ref, t1.CLASS district,
t1.contract_info, SUM (t1.ps_qty) ps_qty, t1.original_amount,
SUM (t2.amount) po_payments,
TO_CHAR (ADD_MONTHS (t2.invoice_dt, 6), 'YYYY') invoice_date_fy
FROM dw_ps_ap_po_rq_fact t1, dw_ps_all_payments_fact t2
WHERE t1.ps_no = t2.po_no
AND t1.ps_line = t2.line_no
AND t1.OBJECT IN ('544020', '544095')
AND (t1.contract_info LIKE '%Salt%' OR t1.contract_info LIKE '%SALT%')
GROUP BY t1.ps_no,
t1.amount,
t1.bud_ref,
t1.CLASS,
t1.contract_info,
t1.original_amount,
TO_CHAR (ADD_MONTHS (t2.invoice_dt, 6), 'YYYY')
My problem here is when i'm adding the "PO_PAYMENT_AMOUNT" for each PO_NUMBER from the second table, even the PO_AMOUNT field is getting repeated and in reporting when i have to submit a summary report its get added up, please help me.
Thanks

Hi,
One thing you can do is use the analytic ROW_NUMBER function to identify exactly one row of output for every row from the DW_PS_AP_PO_RQ_FACT table.
You didn't post CREATE TABLE and INSERT statements for your tables, so I'll use scott.emp to illustrate.
The following query shows all the bosses, and the employees who report directly to each boss. (Bosses can be repeated in the output, because several employees may report to the same boss.) The sal_to_add column is NULL except for one output row per boss, so adding that column gives the accurate total.
SELECT     b.empno
,     b.ename
,     b.sal
,     CASE
          WHEN  ROW_NUMBER () OVER ( PARTITION BY  b.empno
                                      ORDER BY        e.ename
                          ) = 1
          THEN  b.sal
     END     AS sal_to_add
,     e.empno
,     e.ename
FROM     scott.emp     b
JOIN     scott.emp     e     ON     e.mgr     = b.empno
;Output:
.    EMPNO ENAME             SAL SAL_TO_ADD      EMPNO ENAME
      7566 JONES            2975       2975       7902 FORD
      7566 JONES            2975                  7788 SCOTT
      7698 BLAKE            2850       2850       7499 ALLEN
      7698 BLAKE            2850                  7900 JAMES
      7698 BLAKE            2850                  7654 MARTIN
      7698 BLAKE            2850                  7844 TURNER
      7698 BLAKE            2850                  7521 WARD
      7782 CLARK            2450       2450       7934 MILLER
      7788 SCOTT            3000       3000       7876 ADAMS
      7839 KING             5000       5000       7698 BLAKE
      7839 KING             5000                  7782 CLARK
      7839 KING             5000                  7566 JONES
      7902 FORD             3000       3000       7369 SMITHI included both the duplicated sal column and the distinct sal_to_add column, just to show how this worked.
In practice, you mighty only want sal_to_add, or you might want to display only sal, but do the SUM on sal_to_add.
By the way, when posting formatted code on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
It looks like you're trying, but you're only typing the 1st of those 6 characters before the formatted section, and only the 6th of those 6 characters after it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Inventory Loading:complex situation

    hi xperts,
    I am handling the Inventory Management Scenairo:
    1.I already loaded the 2LIS-03_BX,into bw.
    2.For 2lis_03_BF,Since the System has got a lot of load i split the load into Two parts:
      01.01.2006 to 01.07.2006  and 02.07.2006 to 01.04.2007  and i also already initialised the Data,oli1bw for 01.01.2006 to 01.07.2006. in the R/3 Source System.
    3.Now i want to load data into BW,How Should i Proceed With that?Should i go with full update or DELTA init?.
    What about the MARKER UPDATE?should i tick or untick the check box marker update.
    4.And without deleting i.e LBWG,I am unable load the Data for 02.07.2006 to 01.04.2007.So what is the significance of LBWG?.
    5.what are the next steps.
    Can any body help me to solve this complex situation.

    hi,
      thanks for kind and informative reply.
    According to answers given by you.
    1.Its better to go for INIT DELTA for period 01.01.2006 to 01.07.2007,after that
    what ever loads i am doing should be an DELTA LOADS.Is it True?
    When i load the Data as delta I need to  untick the MARKER UPDATE?Is it right?
    2.In the source system side in RSA7 will be full with more 100000 records is that going to give performance problems?
    can you plz give me reply.

  • [svn:cairngorm3:] 21174: Landmark does not work under complex situations

    Revision: 21174
    Revision: 21174
    Author:   [email protected]
    Date:     2011-04-29 11:21:00 -0700 (Fri, 29 Apr 2011)
    Log Message:
    Landmark does not work under complex situations
    https://bugs.adobe.com/jira/browse/CGM-39
    Ticket Links:
        http://bugs.adobe.com/jira/browse/CGM-39
    Modified Paths:
        cairngorm3/trunk/libraries/Navigation/src/com/adobe/cairngorm/navigation/core/EnterAndExi tInvoker.as
        cairngorm3/trunk/libraries/Navigation/src/com/adobe/cairngorm/navigation/waypoint/Waypoin tHandler.as

    Hi John,
    1) I like that the new model adds parameterization. It's cleaner than pulling in parameters from pre-set variables. However, the given example didn't actually make much use of it. The only non-constant parameter multiply-used in the example is the "table" variable. Seems like a lot of work for not a lot of gain, at least in this case?
    2) I am cautious that this new template/model condenses the paradigm sooo much, that it is no longer clear where XPath is involved vs straight constant tag names. Yes, Adobe's example is overly-expanded but that's common in code meant to be a demonstration.
    3) I also am cautious that the example intermingles direct node creation into the XPath search/processing chain. I've learned to be VERY careful with this. It only can work when the changes made do not interfere with the rule processing. In my model, I simply avoid it completely (by not making node-position or node-add/remove/move changes until after tree parsing is complete.) This will always be a safe model.
    Bottom line: while I very much appreciate the parameterization and lintability (is that a word? Sure makes sense to me )... I think I would still define each rule separately rather than bring them all together as an inline array in the rule processing call. To me it seems sooo condensed that the XPath meaning can become lost. (Would someone recognize that //para/section-head is actually an XPath statement that could (in another situation) be //para/* or //para/following-siblings::* ... while some of the other strings are exact-match tag names?)
    I realize this is all a matter of style... my preference: clarity for the future reader, particularly when the future reader is me a year later who forgot what all those parameters and embedded methods were all about ...
    Blessings,
    Pete

  • Lost Apple TV remote. Now how do I control it? This is a complex situation.

    I'm at college and I lost the Apple TV remote to my Apple TV 2.
    Here's my situation.
    I can turn on the Apple TV, but I never connected my Apple TV to the school's network so I'm not able to use the remote app on my iPhone to control it. I plugged in the ethernet port on the Apple TV to the Thunderbolt Ethernet port on my Macbook. This gave the Apple TV internet(thank you Mac hotspot feature) allowing me to get past the "Setting Time and Zone" page that appears first. Now, the Apple TV is at the home screen. I can use the airplay feature on my mac to send stuff to my Apple TV and that work fines. However, when I connect my iPhone to the same network as my computer(my MacBook is sharing that connection with Apple TV), my Apple TV does not show up in the Remote app. So I can't find a way to control it with the Remote app.
    So, how can I control my Apple TV, which is stuck on the home screen?
    Can I buy another Apple TV remote or universal remote and get it to pair with this Apple TV without having to go to the pair remote page?
    I need to find some way to control this thing without having any control of it right now.
    Doesn't Apple have some kind of feature for this type of situation, or is my Apple TV now useless?
    Any ideas?
    Thanks for any help! I would greatly appreciate it!

    all apple remotes work out of the box
    borrow the remote from the neighbors kid Eric that he got with his appletv or imac or macbook or the likes it works
    or buy a new remote it works
    borrow Erics remote and use it to setup remote app on an ios device that works too

  • Photo's Stuck In iPad Complex Situation HELP!

    Okay...here's my problem i have a first gen ipad running ios 5 and a while back the hard drive on my Mac busted so i lost everything but my family photos and important memories are still on that ipad but i don't know how to get it out i don't care much for the music as much but i really need those photo's back, they are visible in my events library but not in my photostream so how do i get it off? help PLEASE!

    To copy photos that were originally synced from a computer you will need a third-party app such as Simple Transfer which can copy them off via your wifi network. But as photos are 'optimised' when they are synced to the iPad, any that you then copy back to a computer may not be exactly the same as they originally were on your Mac.
    iTunes purchases you should be able to copy back via File > Devices > Transfer Purchases, for other content see if the programs listed on this page help : https://discussions.apple.com/docs/DOC-3991

  • Complex

    I have a complex situation here.
    I have a jsp "main.jsp" which contains 2 jsps (using IFRAME tag) plus some other fields. One of those 2 jsp is "frequency.jsp" which lists frequencies with radio buttons besides it. When user change a selection there, I want to grab data from the whole page (i.e. fields of main.jsp + those 2 jsps) and update in the database. To do this I define a jsp "mainupdate.jsp" where I will get all the data and then update the database with it. I put it in main.jsp (make its height and width 0 so that use cannot see it). Then from frequency.jsp, I am calling this jsp.
    <SCRIPT Language=JavaScript>
    function updatedata{
    frequency_form.frequency.value=frequency_form.lastfreq.value;
    frequency_form.method="POST";
    frequency_form.target="update";
    frequency_form.action="mainupdate.jsp";
    frequency_form.submit();     
    In "mainupdate.jsp" I use
    String ba;
    ba=request.getParameter("frequency");
    By this way I can get the Frequency but I dont know how can I get the values from the other jsp plus other fields of main.jsp. Can anybody please help me? Thanks

    I don't think you can really do this using JSP, but what you need to do is have the submit action activated for all the pages when you click the one. You might be able to do this using javascript, you should check some of the javascript sites to see if this is possible (activating foriegn form actions from one page).

  • Complex transformations in SELECT

    Hi everyone,
    I have a pretty complex situation where I have to apply transformations on data in a SQL SELECT Statement. The thing is that I have absolultely no idea how to handle this.
    Let's imagine I have an hierarchy table, like an organizational hierarchy.
    CREATE TABLE organisations
       organisation_id number(10) PRIMARY KEY,
       parent_organisation_id number(10),
       name_en varchar2(255),
       name_nl varchar2(255),
       CONSTRAINT fk_org_to_par_org
          FOREIGN KEY (parent_organisation_id)
           REFERENCES organisations(organisation_id)
    INSERT INTO organisations VALUES (1, null, 'Top organization 01', 'Top organizatie 01');
    INSERT INTO organisations VALUES (11,   1, 'Organization 011', 'Organizatie 011');
    INSERT INTO organisations VALUES (12,   1, 'Organization 012', 'Organizatie 012');
    INSERT INTO organisations VALUES (2, null, 'Top organization 02', 'Top organizatie 02');
    INSERT INTO organisations VALUES (21,   2, 'Organization 021', 'Organizatie 021');
    INSERT INTO organisations VALUES (22,   2, 'Organization 022', 'Organizatie 022');
    INSERT INTO organisations VALUES (3, null, 'Top organization 03', 'Top organizatie 03');
    INSERT INTO organisations VALUES (31,   3, 'Organization 031', 'Organizatie 031');
    INSERT INTO organisations VALUES (32,   3, 'Organization 032', 'Organizatie 032');
    INSERT INTO organisations VALUES (321, 32, 'Organization 321', 'Organization 321');
    INSERT INTO organisations VALUES (322, 32, 'Organization 322', 'Organization 322');And I have to apply some transformations in the SELECT. These transformations are store in a table. I have a few different transformations. I just put 3 here as examples:
    CREATE TABLE transformations
      transform_id number(10),
      transform_type CHAR(1),
      organ_id  number(10),
      organ_name varchar2(255),
      parent_organ_id number(10),
      replace_name varchar2(255),
      with_children char(1)
    INSERT INTO transformations(transform_id, transform_type, organ_name, parent_organ_id, organ_id)
         VALUES (1, 'C', 'Created NODE', 1, -9);
    INSERT INTO transformations(transform_id, transform_type, organ_name, replace_name)
         VALUES (2, 'R', 'Organization 021', 'Organization 021 renamed');
    INSERT INTO transformations(transform_id, transform_type, organ_name, replace_name, with_children)
         VALUES (3, 'R', 'Organization 032', 'Organization 032 Renamed', '1');The first transformation is to create a node under an existing one. The second transformation example is to rename a node. The pattern is actually a regular expression and it will use regexp_replace (to be able to add in the begining, change, add in the end...). The 3rd example is a rename too but all the children of a node should also be renamed with the same pattern.
    I need a result like this one: (I indented to read more easilly)
    1, ,Top Organisation 01, Top organizatie 01    
      -9, 1, Created Node, Created Node     
      11, 1, Organization 011, Organizatie 011
    2, ,Top Organisation 02, Top organizatie 02    
      21, 2, Organization 021 renamed, Organization 021 renamed     
      22, 2, Organization 022, Organizatie 022
    3, ,Top Organization 03, Top organizatie 03    
      31, 3, Organization 031, Organization 031    
      32, 3, Organization 032 Renamed, Organization 032 Renamed
        321, 32, Organization 032 Renamed, Organization 032 Renamed
        322, 32, Organization 032 Renamed, Organization 032 Renamed I was thinking if it was possible to apply these modifications on a SELECT clause without creating another table and refreshing it by parsing the initial table? Any suggestions?
    Thanks,

    Hi Frank, 
    I have been thinking for days on this problem... That's probably why I can't explain it correctly. SO let me try again. Let's restart evrything and recreate the ORGANISATIONS table.
    set define off;
    DROP TABLE ORGANISATIONS;
    DROP TABLE TRANSFORMATIONS;
    CREATE TABLE organisations 
       organ_id number(10) PRIMARY KEY, 
       parent_organ_id NUMBER(10), 
       organ_name varchar2(255), 
       CONSTRAINT fk_org_to_par_org 
          FOREIGN KEY (parent_organ_id) 
           REFERENCES organisations(organ_id)
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (11, NULL, 'Sales');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (23, NULL, 'R&D');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (71, NULL, 'Logistics');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (87, 71, 'Transport');Once you executed the previous statements, you have the following result:
    SELECT organ_id, parent_organ_id, CAST(LPAD(' ', LEVEL * 2) || organ_name as VARCHAR2(25)) AS a
      FROM organisations
     START WITH parent_organ_id IS NULL
    CONNECT BY PRIOR organ_id = parent_organ_id;
    ORGAN_ID               PARENT_ORGAN_ID        A                         
    11                                              Sales                   
    23                                              R&D                     
    71                                              Logistics               
    87                     71                         Transport             The organisation has 3 root department: Sales, R&D and logistics. The logistics department has a child department called transport.
    Now, the previous tree comes from a remote database but that's not the point. It can not be used as provided. I have to apply some modification to that tree before I can use it. That's why I creat the TRANSFORMATIONS table. 
    CREATE TABLE transformations
      transform_id number(10), 
      transform_type CHAR(1), 
      organ_id  number(10), 
      organ_name varchar2(255), 
      parent_organ_id number(10),
      replace_name varchar2(255)
    );Now, every record inserted in that table is a transformation to apply to the original tree. One of the transformation I need to apply is to create organisations. 
    For example:
    INSERT INTO transformations(transform_id, transform_type, organ_id, organ_name, 
                                parent_organ_id)
          VALUES(  35, 'C', -19, 'Local sales', 11);The previous transformation means: Create a new organisation named 'Local Sales' under the Sales organization. Let's review the different values in the INSERT statement. The transform_ID is a generated ID. We don't really care about it.The transform_type 'C' means create an organization (node). The -19 is the ID that that new organization should have. 'Local Sales' is the name of that new organization and 11 is his parent id. That's with this parent-id that I know where to put the new node in the tree.
    After applying this transformtation, the result should be:
    ORGAN_ID               PARENT_ORGAN_ID        A                         
    11                                              Sales                   
    -19                    11                         Local sales 
    23                                              R&D                     
    71                                              Logistics               
    87                     71                         Transport             Of course, I can have other CREATE transformations:
    INSERT INTO transformations(transform_id, transform_type, organ_id, organ_name, 
                                parent_organ_id)
          VALUES(  64, 'C', -23, 'Foreign sales', 11);
    INSERT INTO transformations(transform_id, transform_type, organ_id, organ_name, 
                                parent_organ_id)
          VALUES(  66, 'C', -26, 'South America', -23);
    INSERT INTO transformations(transform_id, transform_type, organ_id, organ_name, 
                                parent_organ_id)
          VALUES(  97, 'C', -13, 'IT', null);After applying these transformations, the result should be :
    ORGAN_ID               PARENT_ORGAN_ID        A                         
    11                                              Sales                   
    -19                    11                         Local sales 
    -23                    11                         Foreign sales 
    -26                    -23                          South America 
    23                                              R&D                     
    71                                              Logistics               
    87                     71                         Transport             
    -13                                             ITI hope this is clear now? I wanted to know if it's possible to apply such transformations directly in the SELECT statement without having to code a PL/SQL package that does it for me?
    Now the problem is that I can have other type of transformations. For example, some nodes should be renamed. 
    For example, if I insert this transformation:
    INSERT INTO transformations(transform_id, transform_type, organ_id, replace_name)
          VALUES(  60, 'R', 11, 'Sales department');Instead of returning the name 'Sales' for the organization with ID = 11, it should return 'Sales department'. The 'R' transformation type means rename and the org_id is the organization to rename and the new name is supplied using replace_name.
    The most difficult transformation is probably the next one. It defines nodes to retrieve by organization. For example, let's add the following data:
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (50, NULL, 'Security');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (51, 50, 'Building');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (80, 51, 'Parkings');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (81, 80, 'Parking 1');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (82, 81, 'Parking 1 - Level 0');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (52, 50, 'Software');
    INSERT INTO organisations(organ_id, parent_organ_id, organ_name) 
         VALUES (52, 50, 'Other kind of security');AS you can see in the following result, the Security organization has 4 levels below.
    SELECT organ_id, parent_organ_id, LEVEL, CAST(LPAD(' ', LEVEL * 2) || organ_name as VARCHAR2(30)) AS a
      FROM organisations
     START WITH parent_organ_id IS NULL
    CONNECT BY PRIOR organ_id = parent_organ_id;
    ORGAN_ID               PARENT_ORGAN_ID        LEVEL                  A                              
    11                                            1                        Sales                        
    23                                            1                        R&D                          
    50                                            1                        Security                     
    51                     50                     2                          Building                   
    80                     51                     3                            Parkings                 
    81                     80                     4                              Parking 1              
    82                     81                     5                                Parking 1 - Level 0  
    71                                            1                        Logistics                    
    87                     71                     2                          Transport                  
     9 rows selected 
     I also should be able to define with a transformation the number of level to retrieve for a specific node. 
    ALTER TABLE transformations 
      ADD max_children number(10) default 4;
    INSERT INTO transformations(transform_id, transform_type, organ_id, max_children)
          VALUES(  20, 'L', 50, 2);In the previous transformation, I specify a 2 level for the organization 50. In this case, the final result should only return 2 level under the organization 50. So instead of having 5 levels as in the previous result, I should have
    ORGAN_ID               PARENT_ORGAN_ID        LEVEL                  A                              
    11                                            1                        Sales                        
    23                                            1                        R&D                          
    50                                            1                        Security                     
    51                     50                     2                          Building                   
    80                     51                     3                            Parkings                 
    71                                            1                        Logistics                    
    87                     71                     2                          Transport                  As you can see, there are a lot of different type of transformations that should be done and I don't think SQL is intented for such things?
    Thank you again for your help Frank, I really appreciate

  • Complex Email Notification

    Hello Forum,
    I am trying to achieve a complex situation. I want to notify changes in a resource form field. The targets of the notification are:
    - The user
    - The operator that makes de change
    - IT Crew responsible of the resource
    The main problem is that in the email body I have to notify who has made the change. For that purpose I am using <Assignee Profile Information.User Login>.
    If I configure the Notification Tab to "User" and "Asignee" I am able to get the login of the person that made the change, but to notify the IT Crew I am using the assignement tab with email send (the adapter of the task is tcCompleteTask), if I configure this assignement, the variable <Assignee Profile Information.User Login> looses its track of the real person that made the change.
    There is any way, trying to avoid coding, that lets me notify to a group of users who made a change in a form of another user?
    Thanks in advance,
    Regards,
    Xisco.

    Going with the deferred task example you'd have to do something like this:
    (Again, it doesn't have to be a deferred task.)
    <Action id="0" name="Add Deferred Task" application="com.waveset.session.WorkflowServices">
        <Argument name="op" value="addDeferredTask"/>
        <Argument name="type" value="User"/>
        <Argument name="name" value="$(accountId)"/>
        <Argument name="subject" value="Configurator"/>
        <Argument name="task" value="Your Workflow Name"/>
        <Argument name="date"> <!-- date the deferred task is to execute -->
            <ref>date</ref> <!-- precalculated date -->
        </Argument>
        <Argument name="date_task_added">
            <!-- add the time the task was actually registered -->
            <invoke name="getTime"> <!-- calculates "now" -->
                <invoke name="getInstance" class="java.util.Calendar"/>
            </invoke>
        </Argument>
        ... other deferred task arguments here
    </Action>IDM will wait until the date the task is to be executed, see the "date" argument. When IDM actually executes the deferred task (it may be a long time after it was originally scheduled to execute if there's been a delay or an outage or whatever) you'll have a variable in your workflow called "date_task_added" that should be a java date object. (Or a string, I can't remember. If it is you'll just have to convert it, no biggy.) That will give you the date the deferred task was registered. Within the workflow you can build another date object using the exact same code to calculate "now".
    From there getting the time difference between both objects is a simple matter of getting the milliseconds for each and doing the math to get the difference. That's just one way, there's dozens of ways of calculating time differences with the java date and calendar objects.
    Note: untested code. You may have to tweak it to work properly.

  • Across row validation in tabular form and across items in row validations.

    Hi,
    We are upgrading to APEX 4.0.
    I need to create a tabular form that will have a start date and an end date. FOr each new row or updated row I need ensure its start date is after the end date of all rows already entered and its end date is after the start date of row being entered. Also that if no end date is entered then no other rows can be found with a null end date.
    SO I need across field validations with in a row and across row validattions. That is I need rowset validations as well.
    Is it possible to do this with APEX? WHat kind of tabular solution would allow these type of validations. How might these validations be done?

    Okay, Here's a quick rundown on how to build a manual form using APEX_ITEM and collections. The process goes in 4 steps: gather the data, display the data, update based on user input, then write the changes. Each step requires it's own piece of code, but you can extend this out as far as you want. I have a complex form that has no less than a master table and 4 children I write to based on user input, so this can get as complex as you need. Let me know if anything doesn't make sense.
    First, create the basic dataset you are going to work with. This usually includes existing data + empty rows for input. Create a Procedure that fires BEFORE HEADER or AFTER HEADER but definitely BEFORE the first region.
    DECLARE
      v_id     NUMBER;
      var1     NUMBER;
      var2     NUMBER;
      var3     VARCHAR2(10);
      var4     VARCHAR2(8);
      cursor c_prepop is
      select KEY, col1, col2, col3, to_char(col4,'MMDDYYYY')
        from table1
        where ...;
      i         NUMBER;
      cntr      NUMBER := 5;  --sets the number of blank rows
    BEGIN
      OPEN c_prepop;
        LOOP
          FETCH c_prepop into v_id, var1, var2, var3, var4;
          EXIT WHEN c_prepop%NOTFOUND;
            APEX_COLLECTION.ADD_MEMBER(
            p_collection_name => 'MY_COLLECTION',
            p_c001 => v_id,  --Primary Key
            p_c002 => var1, --Number placeholder
            p_c003 => var2, --Number placeholder
            p_c004 => var3, --text placeholder
            p_c005 => var4 --Date placeholder
        END LOOP;
      CLOSE c_prepop;
      for i in 1..cntr loop
        APEX_COLLECTION.ADD_MEMBER(
            p_collection_name => 'MY_COLLECTION',
            p_c001 => 0, --designates this as a new record
            p_c002 => 0, --Number placeholder
            p_c003 => 0, --Number placeholder
            p_c004 => NULL, --text placeholder
            p_c005 => to_char(SYSDATE,'MMDDYYYY') --Date placeholder
      end loop;
    END;Now I have a collection populated with rows I can use. In this example I have 2 NUMBERS, a TEXT value, and a DATE value stored as text. Collections can't store DATE datatypes, so you have to cast it to text and play with it that way. The reason is because the user is going to see and manipulate text - not a DATE datatype.
    Now build the form/report region so your users can see/manipulate the data. Here is a sample query:
    SELECT rownum, apex_item.hidden(1, c001),  --Key ID
         apex_item.text(2, c002, 8, 8) VALUE1,
         apex_item.text(3, c003, 3, 3) VALUE2,
         apex_item.text(4, c004, 8, 8) VALUE3,
         apex_item.date_popup(5, null,c005,'MMDDYYYY',10,10) MY_DATE
    FROM APEX_COLLECTIONS
    WHERE COLLECTION_NAME = 'MY_COLLECTION'This will be a report just like an SQL report - you're just pulling the data from the collection. You can still apply the nice formatting, naming, sorting, etc. of a standard report. In the report the user will have 3 "text" values and one Date with Date Picker. You can change the format, just make sure to change it in all four procedures.
    What is critical to note here are the numbers that come right before the column names. These numbers become identifiers in the array used to capture the data. What APEX does is creates an array of up to 50 items it designates as F01-F50. The F is static, but the number following it corresponds to the number in your report declaration above, ie, F01 will contain the primary key value, F02 will contain the first numeric value, etc. While not strictly necessary, it is good practice to assign these values so you don't have to guess.
    One more note: I try to align the c00x values from the columns in the collection with the F0X values in the array to keep myself straight, but they are separate values that do NOT have to match. If you have an application you think might get expanded on, you can leave gaps wherever you want. Keep in mind, however, that you only have 50 array columns to use for data input. That's the limit of the F0X array even though a collection may have up to 1000 values.
    Now you need a way to capture user input. I like to create this as a BEFORE COMPUTATIONS/VALIDATIONS procedure that way the user can see what they changed (even if it is wrong). Use the Validations to catch mistakes.
    declare
      j pls_integer := 0;
    begin
    for j1 in (
      select seq_id from apex_collections
      where collection_name = 'MY_COLLECTION'
      order by seq_id) loop
      j := j+1;
      --VAL1 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f02(j));
      --VAL2 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f03(j));
      --VAL3 (text)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f04(j));
      --VAL4 (Date)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f05(j));
    end loop;
    end;Clear as mud? Walk through it slowly. The syntax tells APEX which Collection (p_collection_name), then which row (p_seq), then which column/attribute (p_attr_number) to update with which value (wwv_flow.g_f0X(j)). The attribute number is the column number from the collection without the "c" in front (ie c004 in the collection = attribute 4).
    The last one is your procedure to write the changes to the Database. This one should be a procedure that fires AFTER COMPUTATIONS AND VALIDATIONS. It uses that hidden KEY value to determine whether the row exists and needs to be updated, or new and needs to be inserted.
    declare
    begin
      --Get records from Collection
      for y in (select TO_NUMBER(c001) x_key, TO_NUMBER(c002) x_1,
                 TO_NUMBER(c003) x_2,
                 c004 x_3,
                 TO_DATE(c005,'MMDDYYYY') x_dt
               FROM APEX_COLLECTIONS
               WHERE COLLECTION_NAME = 'MY_COLLECTION') loop
        if y.x_key = 0 then  --New record
            insert into MY_TABLE (KEY_ID, COL1,
                COL2, COL3, COL4, COL5)
              values (SEQ_MY_TABLE.nextval, y.x_1,
                  y.x_2, y.x_3, y.x_4, y.x_dt);
        elsif y.x_key > 0 then  --Existing record
            update MY_TABLE set COL1=y.x_1, COL2=y.x_2,
                 COL3=y.x_3, COL4=y.x_4, COL5=y.x_dt
             where KEY_ID = y.x_key;
        else
          --THROW ERROR CONDITION
        end if;
      end loop;
    end;Now I usually include something to distinguish the empty new rows from the full new rows, but for simplicity I'm not including it here.
    Anyway, this works very well and allows me complete control over what I display on the screen and where all the data goes. I suggest using the APEX forms where you can, but for complex situations, this works nicely. Let me know if you need further clarifications.

  • Please help - trying to use remote desk top

    Hi!
    Let's see if I can explain this correctly...
    I am on a PowerBook G4 in California and my mom is on her brand new MacBookPro in Ohio.
    I bought the Apple Remote Desktop and installed it on my computer so I could log on and control hers in Ohio so I can teach her to use her new computer.
    I followed all directions, all her preferences and and authorizations are checked on her computer, and spoke with Apple tech support, etc. and here is the problem:
    Her husband's son (who THINKS he is some kind of computer wiz) hacked together an internet connection at her house that goes like this - Speedstream motem to Netgear FVS318 to another Netgear FVS318 to an Airport. Why he did it this way??? Your guess is as good as mine...
    From what I understand, I need to Port Map (?) and the Netgear routers are blocking me from remotly connecting with her computer (?). I have her public IP address and her private IP address...How do I get around these Netgear things????
    Thanks so much for your help!
    Oh, and plugging the Airport directly into the motem is not an option. I believe this is because The Wiz Kid has somehow enabled her husband to connect wirlessly to his printer with an IMac (that would be one of those blue ones from a million years ago that won't even burn a disk..you know the one? That is if you can remember back that far)...

    How do I get around these Netgear things????
    Well, you can't "get around them", per se. In each of them, the ports used for ARD will have to be open, and then eventually forwarded to the internal IP address for your mom's MacBook Pro. Given the (probably unnecessary) complexity of the setup at her house, that's going to be a bit difficult, and very probably not something you can do remotely.
    The ports that ARD uses must be open in each of the routers between the modem and her computer (as well as in any router on your end). ARD uses ports 3293 and 5900 so those must be open. The ports also need to be forwarded in the Airport (if she's using the MBP wirelessly) to the MBP's internal IP address. Someone will have to connect into each router's admininstration function to set up those ports; I'm guessing that you won't be able gain such access remotely, though it's possible.
    It's a complex situation, so it may take some tinkering to get it work, something that's probably going to be difficult from your end. With luck, her husband's son knows enough about what he's doing to be able to help. Anything he can do to simplify the network configuration will be of benefit.
    Good luck.

  • Multiple (updatable) details in the same page.

    Hello,
    I tried to put two updatable details in the same page and got the error
    "Updatable SQL Query already exists on page 11. You can only add one updatable SQL query per page. Select a different page"
    So having more than one updatable detail is not allowed in apex ?
    I have a master table with three details. Should I create one page for each one of them ?
    Thanks in advance
    Bye
    Nicola

    What you want to use are called collections. Here is a simple collection example:
    The process goes in 4 steps: gather the data, display the data, update based on user input, then write the changes. Each step requires it's own piece of code, but you can extend this out as far as you want. I have a complex form that has no less than a master table and 4 children I write to based on user input, so this can get as complex as you need. Let me know if anything doesn't make sense.
    First, create the basic dataset you are going to work with. This usually includes existing data + empty rows for input. Create a Procedure that fires BEFORE HEADER or AFTER HEADER but definitely BEFORE the first region.
    DECLARE
      v_id     NUMBER;
      var1     NUMBER;
      var2     NUMBER;
      var3     VARCHAR2(10);
      var4     VARCHAR2(8);
      cursor c_prepop is
      select KEY, col1, col2, col3, to_char(col4,'MMDDYYYY')
        from table1
        where ...;
      i         NUMBER;
      cntr      NUMBER := 5;  --sets the number of blank rows
    BEGIN
      OPEN c_prepop;
        LOOP
          FETCH c_prepop into v_id, var1, var2, var3, var4;
          EXIT WHEN c_prepop%NOTFOUND;
            APEX_COLLECTION.ADD_MEMBER(
            p_collection_name => 'MY_COLLECTION',
            p_c001 => v_id,  --Primary Key
            p_c002 => var1, --Number placeholder
            p_c003 => var2, --Number placeholder
            p_c004 => var3, --text placeholder
            p_c005 => var4 --Date placeholder
        END LOOP;
      CLOSE c_prepop;
      for i in 1..cntr loop
        APEX_COLLECTION.ADD_MEMBER(
            p_collection_name => 'MY_COLLECTION',
            p_c001 => 0, --designates this as a new record
            p_c002 => 0, --Number placeholder
            p_c003 => 0, --Number placeholder
            p_c004 => NULL, --text placeholder
            p_c005 => to_char(SYSDATE,'MMDDYYYY') --Date placeholder
      end loop;
    END;Now I have a collection populated with rows I can use. In this example I have 2 NUMBERS, a TEXT value, and a DATE value stored as text. Collections can't store DATE datatypes, so you have to cast it to text and play with it that way. The reason is because the user is going to see and manipulate text - not a DATE datatype. If you are using this as part of a master/detail form, make sure that your SQL to grab the detail is limited to just the related data.
    Now build the form/report region so your users can see/manipulate the data. Here is a sample query:
    SELECT rownum, apex_item.hidden(1, c001),  --Key ID
         apex_item.text(2, c002, 8, 8) VALUE1,
         apex_item.text(3, c003, 3, 3) VALUE2,
         apex_item.text(4, c004, 8, 8) VALUE3,
         apex_item.date_popup(5, null,c005,'MMDDYYYY',10,10) MY_DATE
    FROM APEX_COLLECTIONS
    WHERE COLLECTION_NAME = 'MY_COLLECTION'This will be a report just like an SQL report - you're just pulling the data from the collection. You can still apply the nice formatting, naming, sorting, etc. of a standard report. In the report the user will have 3 "text" values and one Date with Date Picker. You can change the format, just make sure to change it in all four procedures.
    What is critical to note here are the numbers that come right before the column names. These numbers become identifiers in the array used to capture the data. What APEX does is creates an array of up to 50 items it designates as F01-F50. The F is static, but the number following it corresponds to the number in your report declaration above, ie, F01 will contain the primary key value, F02 will contain the first numeric value, etc. While not strictly necessary, it is good practice to assign these values so you don't have to guess.
    One more note: I try to align the c00x values from the columns in the collection with the F0X values in the array to keep myself straight, but they are separate values that do NOT have to match. If you have an application you think might get expanded on, you can leave gaps wherever you want. Keep in mind, however, that you only have 50 array columns to use for data input. That's the limit of the F0X array even though a collection may have up to 1000 values.
    Now you need a way to capture user input. I like to create this as a BEFORE COMPUTATIONS/VALIDATIONS procedure that way the user can see what they changed (even if it is wrong). Use the Validations to catch mistakes.
    declare
      j pls_integer := 0;
    begin
    for j1 in (
      select seq_id from apex_collections
      where collection_name = 'MY_COLLECTION'
      order by seq_id) loop
      j := j+1;
      --VAL1 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f02(j));
      --VAL2 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f03(j));
      --VAL3 (text)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f04(j));
      --VAL4 (Date)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f05(j));
    end loop;
    end;Clear as mud? Walk through it slowly. The syntax tells APEX which Collection (p_collection_name), then which row (p_seq), then which column/attribute (p_attr_number) to update with which value (wwv_flow.g_f0X(j)). The attribute number is the column number from the collection without the "c" in front (ie c004 in the collection = attribute 4).
    The last one is your procedure to write the changes to the Database. This one should be a procedure that fires AFTER COMPUTATIONS AND VALIDATIONS. It uses that hidden KEY value to determine whether the row exists and needs to be updated, or new and needs to be inserted.
    declare
    begin
      --Get records from Collection
      for y in (select TO_NUMBER(c001) x_key, TO_NUMBER(c002) x_1,
                 TO_NUMBER(c003) x_2,
                 c004 x_3,
                 TO_DATE(c005,'MMDDYYYY') x_dt
               FROM APEX_COLLECTIONS
               WHERE COLLECTION_NAME = 'MY_COLLECTION') loop
        if y.x_key = 0 then  --New record
            insert into MY_TABLE (KEY_ID, COL1,
                COL2, COL3, COL4, COL5)
              values (SEQ_MY_TABLE.nextval, y.x_1,
                  y.x_2, y.x_3, y.x_4, y.x_dt);
        elsif y.x_key > 0 then  --Existing record
            update MY_TABLE set COL1=y.x_1, COL2=y.x_2,
                 COL3=y.x_3, COL4=y.x_4, COL5=y.x_dt
             where KEY_ID = y.x_key;
        else
          --THROW ERROR CONDITION
        end if;
      end loop;
    end;Now I usually include something to distinguish the empty new rows from the full new rows, but for simplicity I'm not including it here.
    Anyway, this works very well and allows me complete control over what I display on the screen and where all the data goes. I suggest using the APEX forms where you can, but for complex situations, this works nicely. Let me know if you need further clarifications.

  • What is the difference between scheduling agreement and delivery schedule

    Hi
    1. Can anyone explain me the difference between scheduling agreement output
        and scheduling agreement delivey schedule
        Will the both look same in T.code SP02 when seeing the output for a document.
        Can anyone send me T.codes for above ones in purchasing.
    2. when seeing the Detailed statement for rebate agreement,there is item number.
        In which table can we see the item number for rebate agreement

    Hi,
    If you have to deal with more complex situations, you can define a delivery cycle in the material master record in addition to the planning cycle. In so doing, you determine the days on whichthe vendor delivers his goods. The delivery cycle is entered in the material master record as a planning calendar in the Planning calendar field.
    You enter a delivery cycle if the delivery date (or the goods receipt date) depends on the day on which you order the goods. For example, you carry out the planning run and place your orders on Mondays and Tuesdays. If you place the order on Monday, the delivery is made on Wednesday, if you wait until Tuesday to place the order, the delivery is not made until Friday
    Where as Planning calander is Three character number (numeric or using letters) that specifically identifies a PPS-planning calendar. The difference between Planning calender and delivery cycle is If you have selected the MRP type "MRP" and have set a period lot-sizing procedure according to planning calendar, you enter here which planning calendar is to be used.
    If you selected the "time-phased planning" MRP type, the planning calendar that you specify here defines the delivery cycle. This specifies the days on which the vendor delivers the material. You can enter the planning cycle in addition to the delivery cycle

  • Bluetooth remote freezing with PowerPoint on MacBook Pro while idling

    I am experiencing problems with bluetooth remote controls (3 different brands) freezing up when used with MS PowerPoint on a MacBook Pro running Snow Leopard (all updated). It is intermittent in nature and appears to be related to idling when giving presentations. It can freeze as quickly as within one minute to not freezing until 30-40 minutes later. This may not be a remote control issue as the arrow keys on the keyboard will not advance or backup the PowerPoint slides as well. However, when using my iMac computer without the remote, I have not observed the freezing (although, I may not have waited long enough since the nature is intermittent and variable in time).
    When frozen, the mouse centered on the slide with a touchpad click awakes the computer to work properly (quick, but not ideal solution). However, when two screens are utilized (LCD projector or another monitor) via VGA connecion in "Presenter View," the touchpad click does NOT awake the computer, regardless of where the arrow is placed on screen. During this situation, the "presented slide" can be advanced by clicking the forward and backward arrows below this "subwindow" of "Presenter View," and even clicking on the image itself will advance it forward (but not backward). When this happens, the keyboard arrows do not work in advancing or backing up the slide sequence.
    When in this frozen mode with a LCD or 2nd monitor, the only way I have found to get it working again, is to "Exit Show" and pulling down the "Slide Show" tab and selecting "Play from Current Slide." This takes me back to the slide where the computer froze and allows the bluetooth remote to start working again (obviously not an optimal solution, as the software should not disengage). Again, it appears if I keep changing to another slide within a few seconds to a few minutes, the PowerPoint does not freeze up. However, it is intermittent and variable as to the length of time before it freezes up.
    NOTE: I have run these same PowerPoints, with the same remote controls, without any problem for hundreds of hours over the past 3 years. I have updated MS Office 2011, from 2008, last fall and have also run these same items without problems for about 40 hours. I have run Mac "Disk Utility" and just installed a MS Office "Update" released yesterday, which has not corrected the issue as well. Is this issue a MicroSoft problem?
    Bless whoever who has an answer to this complex situation. Thank you!

    I am having the same problem with a minister's MacBook Pro at my church.  It started about 2-3 weeks ago.  We at first thought it was a remote issue and found out that it is not.  He is running a vitually new MacBook Pro with Mountain Lion 10.8.2 OS.  He has Microsoft Office 2011.  He has only had the computer since December.  He runs powerpoint presentations all the time.  He never had a problem until about 2 1/2 weeks ago.  When he runs powerpoint in Presenter Veiw it would freeze up on him.  You can still move the cursor over to the arrows on the presenter view slide windo and phisically click the mouse on the arrows to move forward or backward but none of keys on the keyboard work at all.  It won't even let you escape.  You have to move the cursor over the "Exit Show" button and click there.  We thought that it might be just a presenter veiw issue so we tried running it in "Mirror Mode" and that seemed to work for a while but now we are having the same freezing problems. 
    We have taken the laptop to the Genius Bar and talked to the guys there and they did not tell us anything that helped us.  They found this thread that you all started with our same problem.  It looks like all of us had it happen at the same time.  I find that very interesting.  My minister said that he had not run any updates so we don't think that was the issue.
    I have tried uninstalling Office completely and reinstalling it with all the updates and that did not help.  I was thinking that I have a copy of Office 2008 here in the office and I was going to uninstall 2011 and install 2008 but one of you said you were having the same issue with 2008.  Maybe I can uninstall 2011 and reinstall it without doing any updates and see if that does anything.  We are very baffled and can't seem to get an answer about any of this from Mac or Microsoft.  All we get is one blaming the other.
    Let us know if this is helpfull or if you have any luck.

  • How to Install Windows 8.1 Preview on a Lenovo B575

    First off, if you try to do it the normal way (eg, download ISO and burn to DVD) it will fail miserably and you will end up with an installation that hangs during a shutdown and/or restart plus some features may not work (like your wireless perhaps) so here's how to get it to work by doing a USB Legacy installation workaround:
    1- Download the Win 8.1 ISO and use a utility like ISO to USB to make it bootable via a USB stick.
    2- Once installed on the USB stick, delete the EFI folder and the efibootmgr file  (on the new USB stick).
    Note: This will force a Legacy USB installation - see image for more info.
    3- Complete the installation using the modified USB stick and you will end up with a correct Legacy installation.
    Note: It is very important to delete all existing partitions as part of the "clean install" process.
    Note: See image of Disk Management below.
    Now, there is only one problem left to solve and that is how to create a backup system image because this feature has been removed in 8.1 and doesn't work in Win 8.0 (with a B575) so what to do? The simple alternative is to use a free 3rd party utility like Macrium Reflect Free to create and restore your system images as required. BTW, 8.1 seems to be working nicely but I would not recommend upgrading your primary PC/laptop to take it for a test drive. In my case, I have a test rig for those purposes. Good luck.
    BTW, see my tale of woe on installing Win 8.0 (similar to here):
     http://forums.lenovo.com/t5/IdeaCentre-Desktops-Home-Servers/Lenovo-B575-Update-to-Windows-8-Issue/t...
    Moderator Note; subject edited.  Windows 8.1 is not yet a supported operating system, members installing it do so at their own risk.

    Here is a screenshot of the 8.1 Preview on the B575 (desktop view):
    Link to picture
    Here is Macrium Reflect Free preparing for a system image backup:
    Link to picture
    Now, if you are so inclined to attempt this installation, I would strongly recommend the follow recovery actions:
    1-Download Macrium Reflect Free and make a System Image Backup for recovery to Win 7
    2-Install Win 8.1 as previously described.
    Also note that I have installed the new Classic Shell Beta that works nicely with the return of the Win start button.
    Please understand that all information provided is not an encouragement to attempt an installation of the 8.1 Preview on your Lenovo B575; however, it is intended to help you get through this installation if you are a curious sort (like me) and it is also intended to avoid issues when attempting this upgrade  to your B575 laptop. With that said, I would strongly advise against attempting this upgrade; especially if your laptop is considered a primary computer. The only reason I can do this without fear of consequences is that I use my B575 as a "test rig" to assist others with complexed situations so I am "routinely" switching back and forth between Win 7, Win 8.0, and Win 8.1 as needed. So, take heed and good luck with any decisions you may make.
    Moderator note; picture(s) totalling >50K converted to link(s) Forum Rules

  • How to manage multiple resources in multiple project?

    Hello,
    We are a very small company that has migrated from an in-house TFS solution to using VSO to manage our projects.  One issue we are having is being able to look at outstanding tasks and resources allocated across multiple projects.  What I'm looking
    for is one place where I can see how many hours a person is allocated for a given week for all projects.
    Thank you for your help!
    Curt

    Hi Curtis,
    You can create a single team project and create teams for each of you project. Then you would be able to monitor all team progress etc using root team project and each team progress can be separately monitor. If you use parallel iterations across all teams
    this would be more effective.
    For team capacity you can set full capacity to root level and divided capacity levels to each team.
    Scaled Agile Framework is explaining similar concept here for more complex situations in below article. But you can use a simplified version of it.
    https://msdn.microsoft.com/en-us/library/dn798712.aspx
    Cheers!
    Chaminda

Maybe you are looking for