Returning YES/NO conditionally

I have a table for recording maintenance actions on large ships. The table has a "task_number" column (a code to identify the task) and a "task_class" column which refers to each ship type (small, medium or large ships, for instance). The task numbers are not the PK, and there are duplicates. Each record contains the task number, task class, and more associated information. The task number and task class are never null. I would like to run a query that would return something like this:
If the table contained data such as
TASK_NUMBER | TASK_CLASS
X-3161-0 | SMALL
X-3161-0 | LARGE
X-1984-3 | LARGE
P-3535-1 | MEDIUM
P-3535-1 | SMALL
P-3535-1 | LARGE
TASK_NUMBER | SMALL? | MEDIUM? | LARGE?
X-3161-0 | YES | NO | YES
X-1984-3 | NO | NO | YES
P-3535-1 | YES | YES | YES
So, as you can see, every task number should be included, and then the class applicability follows. I do know ahead of time what all of the "classes" are--I don't have to figure that out at run time.
If this can be done easily with plain SQL, I would appreciate it, but PL/SQL is acceptable too.

As requested, here are the CREATEs and INSERTs. Although, I think the last posts may have answered the question. I'll be giving it a try in a bit.
Thanks for all the help!
CREATE TABLE ship_class
          equipment_id      VARCHAR2(5)     NOT NULL,
          task_nr               NUMBER(3,0)     NOT NULL,
          task_nr_rev          NUMBER(3,0),
          freq                NUMBER(3,0)     NOT NULL,
          man_days           VARCHAR2(5)     NOT NULL,
          class               VARCHAR2(15)     NOT NULL,
          mat_cost_est      NUMBER(6,0)     NOT NULL
CREATE TABLE equipment_id
          equipment_id     CHAR(5) NOT NULL,
          equip_NM          VARCHAR2(65)NOT NULL
CREATE TABLE task_detail
          equipment_id     CHAR(5)     NOT NULL,
          TASK_NR               NUMBER(3,0)     NOT NULL,
          TASK_NR_REV          CHAR(1)     NOT NULL,
          RMRK               VARCHAR2(4000)     NOT NULL,
          TASK_ABRVTN          VARCHAR2(30)     NOT NULL,
          TASK_DC               VARCHAR2(1000)     NOT NULL,
          TASK_TYPE          CHAR(1)     NOT NULL
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('3161', '0', 'A', 24, 10, 'small', 100);
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('3161', '0', 'A', 24, 10, 'large', 1000);
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('1984', '3', 'A', 24, 10, 'large', 75);
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('3535', '1', 'A', 24, 10, 'large', 500);
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('3535', '1', 'A', 24, 10, 'small', 100);
     INSERT INTO ship_class (equipment_id, task_nr, task_nr_rev, freq, man_days, class, mat_cost_est) VALUES
     ('3535', '1', 'A', 24, 10, 'medium', 250);
     INSERT INTO equipment_id (equipment_id, equip_nm) VALUES ('3161', 'FLUX CAPACITOR');
     INSERT INTO equipment_id (equipment_id, equip_nm) VALUES ('3535', 'STEAM NEUTRALIZER');
     INSERT INTO equipment_id (equipment_id, equip_nm) VALUES ('1984', 'TURBO ENCABULATOR');
     INSERT INTO task_detail (equipment_id, task_nr, task_nr_rev, rmrk, task_abrvtn, task_dc, task_type) VALUES
     ('3161', '0', 'A', 'This is a remark', 'ENRGZ FLUX CAP', 'Energize the flux capacitor', 'X');
     INSERT INTO task_detail (equipment_id, task_nr, task_nr_rev, rmrk, task_abrvtn, task_dc, task_type) VALUES
     ('1984', '3', 'A', 'This is a remark', 'CLBRT TRBO ENC', 'Calibrate the Turbo Encabulator', 'X');
     INSERT INTO task-detail (equipment_id, task_nr, task_nr_rev, rmrk, task_abrvtn, task_dc, task_type) VALUES
     ('3535', '1', 'A', 'This is a remark', 'TEST STM NTRLZER', 'Test the Steam Neutralizer', 'P');
I am hoping to create a table with TASK_IDs, which I usually create like this:
SELECT
     t.task_type || '-' || t.equipment_id || '-' ||
          TO_CHAR(t.task_nr, 'FM099') ||
          TRIM(BOTH ' ' FROM c.task_nr_rev) as TASK_ID,
Note that the TASK_ID is composed of parts from two different tables, t. and c.
So I will have the TASK_IDs followed by the task description, task abbreviation, equipment name, etc, and then YES's and NO's based on whether they apply to each ship class. So at the top, I would have SMALL, MEDIUM, and LARGE, with a bunch of YES's and NO's below them.
By the way, how do you guys post mono-spaced? I don't see the <code> tags are working here.

Similar Messages

  • Xdofx function least() always returns Yes

    Hi,
    I am trying to do the following calculation
    I have a aggregated field called AD_IMPS_TOTAL. And I also have a field called PRICE and TARGET_IMPS which are not aggregated fields. And I wish to perform the following calcuation.
    least (AD_IMPS_TOTAL, TARGET_IMPS) * PRICE / 1000
    So I did the following in the RTF template
    <?xdofx:least(sum(current-group()/AD_IMPS_TOTAL), TARGET_IMPS) * PRICE div 1000 ?>
    But the calcuation always returns zero. Even when I just give the least function, it returns Yes.
    Can anyone help me out.
    Thanks,
    Ram

    Hi,
    I am trying to do the following calculation
    I have a aggregated field called AD_IMPS_TOTAL. And I also have a field called PRICE and TARGET_IMPS which are not aggregated fields. And I wish to perform the following calcuation.
    least (AD_IMPS_TOTAL, TARGET_IMPS) * PRICE / 1000
    So I did the following in the RTF template
    <?xdofx:least(sum(current-group()/AD_IMPS_TOTAL), TARGET_IMPS) * PRICE div 1000 ?>
    But the calcuation always returns zero. Even when I just give the least function, it returns Yes.
    Can anyone help me out.
    Thanks,
    Ram

  • RV_PRICE_PRINT_HEAD not returning all output conditions

    Hi experts,
    I am using the FM 'RV_PRICE_PRINT_HEAD' to get the header conditions but it is returning only specific condition types. I need all the header conditions maintained in the sales order.
    Is it possible to get all conditions through this FM ?
    Help me on this issue.
    Thanks & Regards,
    Karthik

    Hi Karthi,
    as documented this function module will return only conditions that are flagged for print output in calculation scheme.
    What is your requirement?
    Regards,
    Clemens

  • BBP_PD_PO_GETDETAIL returns empty item[], condition[] first time

    Hi Expert,
    I have implimented BADI BBP_DRIVER_DETERMINE and assign custom FM zB46B_DPO_TRANSFER to create PO in backend system.
    When I create PO and order it first time... FM zB46B_DPO_TRANSFER is getting called where I want to read PO item condition using FM BBP_PD_PO_GETDETAIL and pass to fm which creates PO in backend.
    FM BBP_PD_PO_GETDETAIL is returning blank table PRIDOC[] (pricing data).
    I pass guid of the PO to the FM to get the details.
    for the saved PO it return every details perfectly.
    Do I need to read from buffer or what... how ???
    Thanks,
    Rajesh.

    hi ,
      Try to read from buffer.
      The below code will work in change Badi so definitely it will work in your badi also.
         DATA: lo_pd_model TYPE REF TO /sapsrm/if_pdo_model_access.
          lo_pd_model = /sapsrm/cl_pdo_model_factory=>get_instance( ).
      lo_pd_model->get_detail(
        EXPORTING
          iv_guid          = is_header-guid
          iv_with_itemdata = abap_TRUE
        IMPORTING
          es_header        = li_header
          ET_PRIDOC        = LT_PRIDOC ).
    if the above method is not working then get the buffer instance for /SAPSRM/CL_PDO_BO_PO_ADV.
    data   lo_pdo_po              TYPE REF TO /sapsrm/if_pdo_bo_po_adv.
      CALL METHOD /sapsrm/cl_pdo_factory_po_adv=>get_buffered_instance
        EXPORTING
          iv_header_guid = ls_header-guid
        RECEIVING
          ro_instance    = lo_pdo_po.
      check the implementation class  /SAPSRM/CL_PDO_BO_PO_ADV which method is suitable to get the condition records.
       the below code is sample method how to call ....
    TRY.
          CALL METHOD lo_pdo_po->/sapsrm/if_pdo_do_schedules~get_schedule_line
            EXPORTING
              iv_item_guid         = ls_item-guid
            IMPORTING
              et_sdln              = lt_sdln
              eo_meta_data_handler = lo_meta_data_handler
            CHANGING
              co_message_handler   = lo_message_handler.
        CATCH /sapsrm/cx_pdo_abort .
        CATCH /sapsrm/cx_pdo_no_authorizatio .
      ENDTRY.
    regards,
    Devi

  • Dynamic select list with display,return val & join condition issue.

    hello,
    I am having a dynamic select list with display, return value
    say for example my select statement is
    select distinct dname d, deptno r
    from dept dt
    right join emp e on (e.deptno=dt.deptno)
    where (condition)
    when i tried this query for my select list, it is not working. It saying that
    " LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query. "
    I am not able to understand the problem. Can anyone help me out with this issue?
    thanks.

    Shouldn't your join have dept as the driving table?
    select distinct dname d, deptno r
    from dept dt
    right join emp e on (dt.deptno = e.deptno)
    where (condition)
    Or using older Oracle standard join
    select distinct dname d, deptno r
    from dept dt, emp e
    where (dt.deptno (+) = e.deptno) AND (OTHER WHERE condition)
    OR
    (Since a right join is just getting the values from the driving table that are NOT in the associated table)
    select distinct dname d, deptno r
    from dept dt
    WHERE dt deptno NOT IN (SELECT deptno FROM emp) AND (OTHER where condition)
    Thank you,
    Tony Miller
    Webster, TX

  • Returns orden with condition VPRS

    Good afternoon,
    I am going to illustrate my problem with an example.
    I have an invoice 1234 with two materials Material M1and M2 both extended to C1 Center A1 Warehouse
    Condition VPRS of each one of the materials in the invoice
    Material Price M1 VPRS value  5100 COP (COLOMBIAN PESOS)
                         M2 VPRS value 2356 COP (COLOMBIAN PESOS)
    I need to make a return order of the M1 material, but to another center to the W1 and L1 warehouse which have a different VPRS that the C1 Center A1 Warehouse for example M1 has a VPRS value 500  COP (COLOMBIAN PESOS).
    When try to create the return order with reference to the invoice brings in the position of the order the initial center that is the C1 but at the time of changing to him the center to W1 in conditions of the M1 material appears 500.
    I need that it takes original value VPRS  of  document reference but the center W1.
    Any aid Thanks

    I believe currently it is newly determining the pricing condition in returns , But it should flow from the reference document.
    In copy control of the F2(Invoice) to RE(Returns) at item level use the Pricing type D.
    Regards,
    SEN

  • CRM Return/Complaint - Manual Condition not getting copied from ECC Invoice

    Hi There,
    I am creating Return/Complaint Request and referencing <i>ECC Invoice in TRANSACTION DATA > Referenced Documents Tab.</i>.
    All other condtions are getting copied except the <b>manual fixed price and manual discount.</b> These condtions are present in the referenced ECC Invoice. So while referencing ECC invoice all the condtions should get copied to CRM Return/Complaint Request.
    Please suggest.
    Thanks and Regards
    Dnyanesh

    HI
    Dyhnayesh are you working this on CRM Service side or trying to do in other IMG?
    make sure that Implement it under crm service varanties with RMA
    Return Merchundise Authority when customer wants to return the good back
    may be faulty one what ever is the reason , this things you have to implement it under IMG>CRM>Service> RMA Waranties
    Reward with Points
    Venkat

  • My iPhone 5 was returned in worse condition from Apple Care

    I had my iPhone 5 serviced under the Sleep/Wake button Replacement Program. It was the only issue the device had. When the phone was returned to me today, I noticed the display now has a ton of dust and/or dead pixels under the front glass I've attached a macro photo of the display.
    This is unacceptable and I'm wondering what steps I can take to get this problem resolved. I sent my phone in to resolve one issue, not to create a new one.

    Contact Apple.
    ◾U.S. iPhone technical support:
    (800) MY-IPHONE (800-694-7466)

  • FM that returns condition price,type and value when PO no.& PO item passed

    Dear All,
    I am in search of FM that returns all the condition types and its repective values,price for a given PO no. and PO item number.
    I used BBP_CONDITIONS_GETDETAIL FM which is not suiting my requirement because , i need only those conditions whose konv-kappl = 'TX' , where as this FM returns all those conditions used for that PO.
    I am looking for your valuable inputs.
    Regards,
    Swetha.

    Hi Swetha
    From what u'v written , i understand that you need sumthing like this...
    PO 1 , Item1
    cond - A --200
    cond - B --450
    PO1, Item2
    cond- A -- 350
    So you would want your result as:
    PO1
    Cond A = 550
    Cond B = 450.
    Now if i am correct here, the first step is data fetching which would be really simple.
    Next just sort you internal table by condition number and condition type.
    Then use AT NEW with ref to Condition Record Number and then Condition Type, to sum.
    That should be it.
    Cheers
    Ravish

  • NonDatabase field doenot returning the value

    Hi.,
    I am using jdev11.1.5
    I had created a read only view object using sql querry
          select count(*) "var_count",aj_appl
          from appl_journals
    where
    aj_status = :StatusBV and
    aj_appl = :appl
    group by aj_applI had also created a transient attribute which satisfies the condition
    if (VarCount!=0 && AjAppl != null) {   'Yes';   }  else if (AjAppl != null) {   'No'; }while i am running in Business Component Browser it doesnot retrun any value.,

    try this
    if (VarCount!=0 && AjAppl != null) {  return  'Yes';   }  else if (AjAppl != null) {  return  'No'; }Edited by: M.Jabr on Sep 27, 2011 1:09 PM

  • GetAuthUser function problem inside a condition

    I just recently moved to CF7, when I worked on CF6.1 I used
    the condition:
    <cfif GetAuthUser() EQ "">
    Or
    <cfif GetAuthUser() IS "">
    But in CF7 it doesn't work. I have tried adding to the
    condition: IsDefined("GetAuthUser"), but still the condition is
    never met.
    I also tried including an empty <cflogin> before the
    condition. still to no avail.
    Thank you in advanced on any idea on how to tackle this
    problem,
    Silver Strike

    I do believe that GetAuthUser()
    always exists. It can sometimes be a blank string, but
    that's another matter. This code should always return "yes":
    <cfset user = GetAuthUser()>
    <cfoutput>#IsDefined("user")#</cfoutput>
    (the argument in the isDefined() function must be the name of
    a variable)

  • IBots - How to send an alert when NO records are returned

    It seems straightforward enough to send an alert when a query produces results, but I want to do the opposite. For instance, I only want to get an email at 7am when an object has no data in it for the current day. I do not want to know every day that records are returned.
    how would i set up such an iBot such that it fires every day, and only emails me when no records are returned form the query?

    1) Create a small report called "No Records" and create an unscheduled iBot for this report.
    2) You have your iBot created for the original report, yes? Okay. If you don't want any notification when records are produced for this iBot, then in the Destinations tab, make sure all the boxes are unchecked for "Specific Devices."
    3) Now in the Advanced tab, click on the "Add Action" button under the "Execute these actions when no records are returned by the conditional request" section.
    4) Click on "iBot."
    5) Navigate to the "No Records" ibot created in step one.
    Now, when the original ibot fires and there are records, nothing will be sent because you unchecked all ways to get notification. But when there are no records, this event will fire the chained ibot you linked to in the Advanced tab. This iBot will have as an attachment, your report that says "No Records."

  • How can I display True/False in my dropdownlist as "Yes" and "No"?

    Hi All,
    I want to bind a dropdownlist to a boolean value (so it's either true or false).  I'm particularly interested in using two-way binding to when the user changes from "yes" to "no" the boolean value automatically changes from "true" to "false."  But, I want the user to see "yes" and "no" as the options, rather than "true" and "false".
    How can I display "yes" and "no" and still take advantage of binding?  Or can I not use binding in this circumstance?
      -Josh

    Solution 1:
    In order to display Yes/No for True/False, you may specify labelFunction for the dropdownList.
    In MXML:
    <s:DropDownList labelFunction="myLabelFunction" />
    In actionscript:
    private var arr:ArrayCollection = new ArrayCollection(["true","false"]);
                private function mylabelFunction(item:Object):String
                    if(item.toString() == "true")
                        return "yes";
                    else return "No";
    OR
    Solution2:
    may be u can try making an array collection like
    private var arr:ArrayCollection = new ArrayCollection([{label:"yes",value:"true"},{label:"no",value:"false"}]);
    and specify labelField for the dropdownList like
    <s:DropDownList labelField="label" dataProvider="{arr}" />

  • Button condition on page item and Validation error Conflict

    Hi,
    I have a select list page item and a button on page whose condition is based on the select list page item value(eg, If (:P2_item1='val1'){return true;}) with condition type=PL/SQL function returning boolean. This buttons submits the page.
    It' coming fine in normal case. However, if I select some value val2 from the list and then click the button, and if there are any validation errors (like mandatory check or email check fail etc), then the button disappears because it evaluates the button condition based on the changed value(val2), but the page has not yet been submitted because of validation errors.
    I think this can be solved if I create the button condition based upon database column value instead of page item as db col value won't change until the page is submitted.
    This look like very basic use-case and I would like to know if there is any better solution to this problem.
    Note: I am using Apex 4.2.1

    I don't want to show/hide the button on the change of the page item lov value, so i am not using Dynamic action.
    What i was is to make button visible based on a condition(which is based on page item), for which we have condition attribute of a button available.
    This is a very common thing where a user chooses the button condition as Value of item/column in expression 1 is null/expr2. But what if the user changes the page item value but it doesn't get submit due to validation error. In that case, the button condition fails.
    So, i guess i have to use column name in expression 1, can u tell how to do that?
    Expression 1 = IF (:P2_STATUS='val1') then return true;
    How to change the above to use db column 'status' instead? Any direct way(like #Status#) or I have to query db to get it using select.
    Any alternative approach?

  • Freight Conditions not populating on free of charge sales order deliveries

    I need some assistance, please.  I have searched SCN, but have not been able to find a solution to my problem.
    We need to be able to charge freight charges on Free of Charge sales orders and am not able to get the charges to populate in the delivery.  We send the product for free, but sometimes need to charge the customer shipping charges.
    Below are steps I have completed:
    Created custom header condition of ZFRC
    Added to sales order pricing procedure as a manual condition
    (the charge will be updated from external system)
    Created Delivery Pricing procedure containing only my
    freight conditions (also manual condition)
    VTLA settings for item category KLN (free of charge item):Condition Order requirements – 1 Header
    VTFL settings for item category KLN:
    Pricing Type – D  Copy pricing elements unchanged
    Price Source – E  Delivery/Order
    There are times when the freight charges will be added to the sales order, but I also need to be able to add them directly on the delivery.
    When charges are added directly to the sales order, they will flow thru to the invoice without an issue, but when I try to add at the delivery level, they are not populating, which results in $0 invoice.
    I am not receiving any kind of error messages when trying to add the charges.
    We also have this situation with standard orders, but I am not having any problems with it.  I tried to mimic that set up for free of charge orders, but it is not functioning properly.
    Any assistance would be much appreciated. 
    Thanks!

    Hi Amitesh,
    Yes, the condition type used in the Sales Order is the same, ZFRC and it is also a header condition. 
    The condition analysis is not available in the invoice because there is no condition in the invoice.  Below are screen shots of the analysis from the LINE ITEM of the delivery note (there is not analysis available on the header) and the header details of the conditions from the invoice and the delivery.
    Line Item Analysis:
    Delivery Header Details:
    Invoice Header Details:
    Please let me know if you need further information.
    Thank you for your assistance!

Maybe you are looking for