Deriving 1 Value from 2 Fields Based on Values in Fields

I have a query that needs to return 1 of my values based on the values from 2 fields from 2 tables. However, the value should only be returned in 1 field and one of the fields should be evaluated first. If this first evaluated field has a certain value ('Y') then the other field is ignored.
To be more clear, per the normal query below, what I want is to somehow, if possible, combine the case t2.el_contr and case t1.contr_type statements so that one field, say: mbr_contr_type_desc returns a value.
So that if the value of t2.el_contr is 'Y' then 'SUB CHILD' is returned. It is important that this field should be evaluated first (If the value of it is 'Y' then the other field evaluation can be ignored). If this is not 'Y', then t1.contr_type should be evaluated and the values as listed below also returned to mbr_contr_type_desc.
I know the following isn't correct, but it might better illustrate what I'm trying to do (the normal query is below this)
case t2.el_contr
when 'Y' then 'SUB CHILD'
case t1.contr_type
when 'A' then '1 PARTY MALE SUB'
when 'B' then '1 PARTY FEMALE SUB'
when 'C' then '2 PARTY MALE SUB'
when 'D' then '2 PARTY FEMALE SUB'
when 'F' then 'FAMILY MALE SUB'
when 'G' then 'FAMILY FEMALE SUB'
end as mbr_contr_type_desc
In an Access query I would do the following in a column:
iif([el_contr]='Y',"SUB CHILD',SWITCH([contr_type]="A","1 PARTY MALE SUB",[contr_type]="B" etc.))
*NORMAL QUERY*
select t1.ssn
t1.type,
t1.grp_id,
t1.contr_type,
t2.el_contr,
case t2.el_contr
when 'Y' then 'SUB CHILD'
end as mbr_contr_type_desc_2,
case t1.contr_type
when 'A' then '1 PARTY MALE SUB'
when 'B' then '1 PARTY FEMALE SUB'
when 'C' then '2 PARTY MALE SUB'
when 'D' then '2 PARTY FEMALE SUB'
when 'F' then 'FAMILY MALE SUB'
when 'G' then 'FAMILY FEMALE SUB'
end as mbr_contr_type_desc_1
from member_elig t1
inner join grp_master t2 on
t1.grp_id = t2.grp_id

Perfect!
Thanks, didn't know that existed. Still learning my way around pl/sql..
One other (unrelated) question..when i hit the CTRL+LEFT ARROW* button in my SQL window, it will not tab back. This is really annoying! I have looked through PREFERENCES-EDITOR and can't seem to find any setting that will allow this. Do you know of any way to change this so I can tab backwards/fowards through code in the SQL window?
Thanks for any suggestions!
*Or CTRL+RIGHT ARROW for that matter..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • To fetch the srtfd value from PCL2 based on Pernr

    Hi,
    is there any function module to fetch field (srtfd ) value from PCL2 based on the pernr. My selection screen is having only pernr as the input and now have to get the srtfd value from PCL2.
    Kindly suggest me if any FM or best procees existed.
    Thanks,
    Murthy.

    Please somebody reply.

  • I have created a PDF form with multiple drop downs, all with the same drop down values. When I select a value from 1 of the drop down fields, it replicates in all of the others - which I do not want. How can I fix this?

    I have created a PDF form with multiple drop downs, all with the same drop down values. When I select a value from 1 of the drop down fields, it replicates in all of the others - which I do not want. Can I fix this?

    I'm fairly new to this, but I think it has to do with the way you have the drop downs named. Did you copy one then keep pasting it in each field? If so, that is the problem. You should rename each one with a different number: Dropdown1, Dropdown2, etc. I think that might solve the issue.

  • Populate f4 values of a field based on value of other field

    Hi,
    I have created select options using WDR_SELECT_OPTIONS.For one of the fields ,f4 values should be based on value of another field in the screen.
    How will i achceive this requirement.
    I got a link about the same but that is not using WDR_SELECT_OPTIONS
    http://www.sdn.sap.com/irj/scn/logon?redirect=/irj/scn/wiki?path=/display/WDABAP/Using%20Search%20help%20attachments%20for%20WebDynpro%20ABAP
    I got another link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    which I am going to try
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Jun 22, 2011 6:49 AM

    Hi,
    Using OVS you can achieve this.,  In OVS Event Handler read the value based on which you  want to display F4 for other field and populate the values based on the first field.
    this link is fine., go through this: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Auto population of data to fields based on other input field.

    In overview screen, I have one input field "Business Partner" which contain search help.  As soon as business partner selected from dropdown, the other input fields like Name, Address, City, state should automatically populated without hit of 'ENTER' key.
    I verified with method DO_PREPARE_OUTPUT, but it is triggering only by hitting ENTER key. Is there any event or method which will trigger after business partner selected from dropdown? or any other option to achieve to auto populate the fields.
    Please find attached screen.
    Thanks in advance.

    Hi Narayana,
    You can use the get p method for setting up the values without pressing the enter.
    CASE iv_property.
        WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
          rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
        WHEN if_bsp_wd_model_setter_getter=>fp_server_event.
          rv_value = 'AI_SELECT'.( you can give here the event name)
        WHEN OTHERS.
      ENDCASE.
    Define event with the same name above( AI_SELECT),
    You can set the value of fields based on the first field value within this event.
    Thanks,
    Dharmakasi.

  • Disabling a field based on value of three dff fields

    Hi,
    I am trying to disable a dff field based on the value of three dff LOV fields. User selects the value of these three dff from lov. I am using the below code in processRequest method of the controller but its nt giving me desired result. Kindly help me.
    Code:-
    OAMessageLovInputBean selectedSiteUseDetailDFF1 = (OAMessageLovInputBean)paramOAWebBean.findIndexedChild("SiteUseDetailDFF1");
    OAMessageLovInputBean selectedSiteUseDetailDFF2 = (OAMessageLovInputBean)paramOAWebBean.findIndexedChild("SiteUseDetailDFF2");
    OAMessageLovInputBean selectedSiteUseDetailDFF3 = (OAMessageLovInputBean)paramOAWebBean.findIndexedChild("SiteUseDetailDFF3");
    OAMessageLovInputBean selectedSiteUseDetailDFF4 = (OAMessageLovInputBean)paramOAWebBean.findIndexedChild("SiteUseDetailDFF4"); --want to disable this
    String contextVal = null;
    String lobVal = null;
    String atmVal = null;
    String defVal = "ATM Data Fields";
    String defLobVal = "ATM";
    String defAtmVal = "ENV";
         if (selectedSiteUseDetailDFF1!= null && selectedSiteUseDetailDFF2!= null && selectedSiteUseDetailDFF3!= null)
                        contextVal = selectedSiteUseDetailDFF1.getText(paramOAPageContext);
                        lobVal = selectedSiteUseDetailDFF2.getText(paramOAPageContext);
                        atmVal = selectedSiteUseDetailDFF3.getText(paramOAPageContext);
                   if(contextVal == defVal && lobVal == defLobVal && atmVal == defAtmVal)
                        selectedSiteUseDetailDFF4.setDisabled(true);
    Regards,
    Rajeev

    Rajeev,
    Can you try printing the below value to check whether it's returning the expected value. let me know if its returning the screen value.
    contextVal = selectedSiteUseDetailDFF1.getText(paramOAPageContext);
    lobVal = selectedSiteUseDetailDFF2.getText(paramOAPageContext);
    atmVal = selectedSiteUseDetailDFF3.getText(paramOAPageContext);
    Regards,
    Gyan

  • Error getting value from collection to a date picker field

    Hi all,
    I'm stumble with getting correct data value from collection.
    The column is described as
    'wwv_flow_item.date_popup(3,null, c002, 'dd/mm/yyyy', 10, 10) purchase_date'
    This field is causing error: 'report error:
    ORA-01843: invalid month'
    I'm sure, c002 has correct value '08/08/2003' because I've temporarily changed description of the field to
    'htmldb_item.text(3,c002,10) purchase_date' that returned correct value.
    What can be wrong? I'm puzzled.
    Any suggestion please.

    Are you sure that when you used 'htmldb_item.text(3,c002,10) purchase_date' you got 08/08/yyyy and not 0808yyyy. I have seen that message often in Oracle (outside of HTMLDB) and it is normally when one assumes one format when it is actually another, or the leading zero gets dropped (08082005 becomes 8082005, which converts to 80/82/0205).

  • Get the value from dropdown list (selectedIndex) and text field -- not working

    Hi All,
    I am trying to find and change by the values selected by user using dropdown and text field. Here is the code.
    ChangeRevDetails();
    function ChangeRevDetails(){
              var myDialog = app.dialogs.add({name:"Enter copyright information"});
    //    var monthlist = col1.dropdowns.add('myList', undefined, myList);
              var col1 = myDialog.dialogColumns.add();
              var col2 = myDialog.dialogColumns.add();
        col1.staticTexts.add({staticLabel:"Month:"});
              col1.staticTexts.add({staticLabel:"Year:"});
        col1.staticTexts.add({staticLabel:"Rev. no.:"});
        var myList = [ "January", "February",  "March", "April", "March", "April", "May", "June", "July", "August", "Sepetember", "October", "November", "December" ];
         var myMonth = col2.dropdowns.add({stringList:myList, selectedIndex:0, minWidth:100});//{minWidth:100});
         var myYear = col2.textEditboxes.add({editContents:"2013", minWidth:100});  
         var MyRev = col2.textEditboxes.add({minWidth:100});
        var RevMonth = (myList [myMonth.selectedIndex]);
        var RevYear = myYear.editContents;
        var RevNumber = MyRev.editContents;
        var RevToReplace1 = RevMonth +", "+ RevYear;
        var RevToReplace2 = RevMonth +", "+ RevYear + " Rev. " + RevNumber;
        var myResult = myDialog.show();
            if(myYear.editContents == "") //entry is ""
            alert("Please enter some text into the contents field.");
            ChangeRevDetails();
            else if(myResult == true) //user entered datas
                alert (RevMonth);
                alert (RevYear);
                alert (RevNumber);
                alert (RevToReplace1);
                alert (RevToReplace2);
                app.findGrepPreferences = NothingEnum.nothing;
                app.changeGrepPreferences = NothingEnum.nothing;
                // grep find/change
                app.findGrepPreferences = app.changeGrepPreferences = null;      
                app.findGrepPreferences.findWhat = "[\\l\\u]+?\\s?\\d{4},?\\s+[\\l\\u]+\\.*\\s+\\d+";
                app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
                app.changeGrepPreferences.changeTo = RevToReplace1;
                app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
                app.activeDocument.changeGrep();
                app.findGrepPreferences = NothingEnum.nothing;
                app.changeGrepPreferences = NothingEnum.nothing;
        else //implies user clicked cancel
        myDialog.destroy();
    The problem is, it is not taking the value which the user selects from the dropdown and the text field. It takes the default value as "January" and the year is "2013" as both of these values are given as selectedIndex:0 and editContents:"2013". I have compared the coding with some other working scripts as well, but it is not working. I have added several alert boxes to check the value we get.
    Also, the find and change is also not working. Please help me on this. Thanks.
    Regards,
    Muthuraj. D

    Change the order for dialogresults:
    var myYear = col2.textEditboxes.add({editContents:"2013", minWidth:100});  
    var MyRev = col2.textEditboxes.add({minWidth:100});
    var myResult = myDialog.show();
    if(myYear.editContents == "") //entry is ""
    alert("Please enter some text into the contents field.");
    ChangeRevDetails();
    else if(myResult == true) //user entered datas
    var RevMonth = (myList [myMonth.selectedIndex]);
    var RevYear = myYear.editContents;
    var RevNumber = MyRev.editContents;
    var RevToReplace1 = RevMonth +", "+ RevYear;
    var RevToReplace2 = RevMonth +", "+ RevYear + " Rev. " + RevNumber;
    didn't have a look for the find change problem

  • How to display f4 help for a field based on value of another field

    Hello All,
    I have 4 fields : Sales Org : VBAK-VKORG, Distrib Channel : RV50A-VTWEG, Div : RV50A-SPART, Sold-to-party : KUAGV-KUNNR.
    The second field depends on the first one, the third on the second one and the fourth on the first field.
    However, when each of the second third and fourth fields' f4 help is displayed, the values are independent of the previous fields. How do I set the f4 help to display values based on the respective fields?
    Regards,
    Mithun

    Please be sure that you are searching the forums before posting. This exact same question was asked just yesterday:
    F4 help to input field
    In particular study the section and the linked help document for ddic search helps export/importing parameters and the requirements for DDic Structure/table usage for the parameter mapping.

  • Fetching Values from Ancestors based on UDA condition

    Hi,
    I have a typical requirement where I  need to fetch data from the ancestor based on a particular UDA condition.
    For ex: See the below exhibit
    Dimension
    ----A (UDA: xyz)
    -------B (UDA: xyz)
    ------------C
    -----------------D
    -----------------E (UDA: xyz)
    -----------------F
    Requirement: (Should be a member formula on a particular Account member - No calc script)
    1- Calculations should happen only for members with UDA 'xyz'
    2- The value for member 'E' should come from its first immediate ancestor with same UDA as'E' has - in the above case the value of 'E' should be from member 'B' (and not 'A')
    similarly while calculating member 'B', it should take value from member 'A'
    I have tried the member formula like:
    @ANCEST(DimName,@Currmbr(Dimname)) AND @UDA(DimName,'xyz)
    but this gives 'DOUBLE VALUE STRING' error.
    Can anyone help me with how I should develop the logic for this requirement.
    Thanks again.

    DEAR ALL !
         I HAVE SOLVED THE ISSUE BY USING ANOTHER BAdI " HRBAS00_STRUAUTH".
    THANKS AND REGARDS,
    S.SURESH

  • BBP_PO_INBOUND_BADI:Transfer value from SRM to ECC PO custom field

    Hello, everyone
         Our SRM version is 7.13 with classic scenario,  ECC version is 6.17.  transferring quotation data to ECC for creating PO by PI.
        I created a custom field such as Z1 for PO in ECC ,  I need transfer someone value from SRM to Z1 when press 'create PO' in quotation,
    So  I have to use BADI:BBP_PO_INBOUND_BADI in ECC before PO generating,  but I found the breakpoint can not  reach this BADI, Why ?  how should I do?
    I used to apply normally  this BADI in SRM7.02 and ECC6.05  without PI  with extend classic scenario.
    Thanks very much
      Jesse.

    Hi Jesse,
    I think the BBP_PO_INBOUND_BADI  is used to enhance the data when the PO is sent via BAPI.
    Please check the PI interface name that you are using and find out the Proxy name (in Tcode: SPROXY) and find an Enhancement spot (either in SRM or in ECC).
    Regards
    Venkat

  • APEX 4.1 show hide fields based on value of checkbox/radio

    I am trying to successfully hide and show fields based on the value of a clicked checkbox.  I am using a dynamic action, but it isn't working. 
    I followed the sample at Does Oracle Apex 4 enable the following AJAX features? (ie without the dev writing the Javascript) - Stack Overflow
    I even tried a radio button, but it didn't work.  I cannot uncheck the radio button.  What am I doing wrong?  Thank you for any help you can provide.

    Hi,
         create a dynamic action for page load to hide the item which you wanna hide
         now create another dynamic action
         event : Click
         Selection Type : Items
         Items : P1_Check_box(name of the check box item)
         condition : equal to
         value : return value of the check box item (if you click the check box and the return value is 1 then just add 1)
         in true actions
         Action : Show
        Selection Type : Items
         Items : P1_Text_field(name of the field)
         uncheck fire on page load
         create exact opposite false action, that's it.
    Regards,
    Mohan.

  • Display text fields based on value

    I have a form that has 7 text fields that are to be filled out. I have an ajax process that auto-populates those 7 fields with values based off of the return value of a pop-up dynamic LOV. Is there any way that I can hide the last 5 fields based on a certain value of one of the text fields?
    For example, my fields are:
    P1_Badge (LOV query)
    P1_First_Name
    P1_Last_Name
    P1_Title
    P1_Phone
    P1_Room_No
    P1_Email
    P1_Fax
    The LOV returns a Badge number and populates the rest of the values. But if the Last_Name = 'Smith' then I only want to display Badge, First_Name, and Last_Name and I want to hide the rest of the fields or make them disabled for editing.
    Is this possible without any kind of page submit?
    Thanks,
    Dirk

    Hello,
    Take a look at this page http://apex.oracle.com/pls/otn/f?p=11933:39 it has examples of what you want.
    Regards,
    Carl
    blog : http://carlback.blogspot.com/
    apex examples : http://apex.oracle.com/pls/otn/f?p=11933:5

  • Deleting rows from table based on value from other table

    Hello Members,
    I am struck to solve the issue said below using query. Would appreciate any suggestions...
    I have two tables having same structures. I want to delete the rows from TableA ( master table ) with the values from TableB ( subset of TableA). The idea is to remove the duplicate values from tableA. The data to be removed are present in TableB. Catch here is TableB holds one row less than TableA, for example
    Table A
    Name Value
    Test 1
    Test 1
    Test 1
    Hello 2
    Good 3
    TableB
    Name Value
    Test 1
    Test 1
    The goal here is to remove the two entries from TableB ('Test') from TableA, finally leaving TableA as
    Table A
    Name Value
    Test 1
    Hello 2
    Good 3
    I tried below queries
    1. delete from TestA a where rowid = any (select rowid from TESTA b where b.Name = a.Name and a.Name in ( select Name from TestB ));
    Any suggestions..
    We need TableB. The problem I mentioned above is part of process. TableB contains the duplicate values which should be deleted from TableA. So that we know what all values we have deleted from TableA. On deleted TableA if I later insert the value from TableB I should be getting the original TableA...
    Thanks in advance

    drop table table_a;
    drop table table_b;
    create table  table_b as
    select 'Test' name, 1 value from dual union all
    select 'Test' ,1 from dual;
    create table table_a as
    select 'Test' name, 1 value from dual union all
    select 'Test' ,1 from dual union all
    select 'Test' ,1 from dual union all
    select 'Hello' ,2 from dual union all
    select 'Good', 3 from dual;
    /* Formatted on 11/23/2011 1:53:12 PM (QP5 v5.149.1003.31008) */
    DELETE FROM table_a
          WHERE ROWID IN (SELECT rid
                            FROM (SELECT ROWID rid,
                                         ROW_NUMBER ()
                                         OVER (PARTITION BY name, VALUE
                                               ORDER BY NULL)
                                            rn
                                    FROM table_a a
                                   WHERE EXISTS
                                            (SELECT 1
                                               FROM table_b b
                                              WHERE a.name = b.name
                                                    AND a.VALUE = b.VALUE))
                           WHERE rn > 1);
    select * from table_a
    NAME     VALUE
    Test     1
    Hello     2
    Good     3Edited by: pollywog on Nov 23, 2011 1:55 PM

Maybe you are looking for

  • Update Routine - ABAP code

    Hi, I am trying to write an update routine to calculate and populate fields in my ODS infoprovider. one of the key figure field in my update rules is 'No. of Days'. Based on the 'No. of Days' range, I want to send a key figure(Infoobject:Due amount)

  • Delivery header billing status is different from any of items.

    Dear Friends ,                I have a peculiar case . There is a delivery document which is usually not relevant for billing . Each of the items in the delivery is showing billing status as 'blank' which means not releavant for billing . The item ca

  • Can we create a new row in a table using a down arrow

    Hi, I am using jdeveloper 11.1.1.6. For one of my project, I have a requirement where i need to create a new row in table using a down arrow. My client does not want to use mouse clicks. They want to use keyboard as much as possible.(Fast data entry)

  • Crystal Reports Templates usage - SAP BW MDX query data

    Hi Ingo, How are you? I am experiencing issues with crystal reports when trying to use crystal reports templates with SAP BW data. I have successfully created Crystal Report using SAP BW data with NodeID,  ParentNodeID hierarchy, Crystal Hierarchical

  • Image editing withing Elements 2

    Hello Can anyone help a novice out?? I want to use an image for a background as part of my website. What i want to do is have the main "graphic" to the right hand side of the screen (set as semi transparent) and then fade the image to white towards t