Possible to do conditional ands?

I don't know if this is possible or not. so I thought I should ask the experts.
I have a function and I need to create a query that has conditional ands.
what I'm looking for is something like this:
the function has a few in variables. one of them is p_view
in my where clause I was hoping to do something like this:
where a.course_id = b.course=id
if p_view = 1 then
and a.supervisor = p_super
elseif view = 2 then
and a.emplid = p_emplid
else
and a.emplid = b.emplid
end if;
and a.role = b.role;
now this is not real code, I've tried a decode and that did not work, then tried case, that did not work. so I'm not sure if its possible or not.
can this be done or is there some other way to do this I don't know about?

Hi,
I've tried a decode and that did not work, then tried case, that did not work.Why not? How did you try?
When asking questions, be as specific, clear and concisive as possible, so we can help you as best as possible.
'It didn't work' isn't adding anything to that.
now this is not real codeDon't post unreal/syntactically wrong code, it only distracts and confuses, raises more questions.
Post real code or a clear description of the requirement.
can this be done or is there some other way to do this I don't know about?Hm...my guess is that it can be done, and I wouldn't rule out getting it done using case yet.
If possible, please provide the real query and explain why 'it didn't work'.
We need to know the requirement here.
All I can think of with your given input is this wild shot in the dark, however it might give you an idea:
where a.course_id = b.course_id
and ( case
        when p_view = 1 and a.supervisor = p_super then 1
        when p_view = 2 and a.emplid = p_emplid then 1
      end
    )  = 1
and a.emplid = b.emplid --not sure about this here at all
and a.role = b.role;Remember to use the tag before and after your examples.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.? I want to alter the formatting (i.e., text and/or cell background color), but not cell content.

    Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
    I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).

    Hi Tom,
    Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
    Please explain what you are trying to do.
    Regards,
    Ian.

  • Is it possible to do conditional Summation in e Text templates

    Hi,
    We are having the following requirement.
    The XML being generated has data for all the counties. But we need to find the sum of FIT_GROSS_WAGES only when the county_name is in a specific list of values, which we can hardcode in the template.
    some thing like
    if county_name in ('Perry', 'Bucks')
    then
    sum_FIT_GROSS_WAGES = sum_FIT_GROSS_WAGES + FIT_GROSS_WAGES
    end.
    We tried with
    SUM(DECODE(,’Perry’,INTEGER_PART(TO_NUMBER(FIT_GROSS_WAGES)*100), ’Bucks’, INTEGER_PART(TO_NUMBER(FIT_GROSS_WAGES)*100), 0))
    But its not working
    We have copied the template and sample xml to
    http://www-apps.us.oracle.com:1100/~svannian/Template_change/
    Can some one clarify if its possible to achieve this in an e-text template?
    Thanks.

    Hi vetsrini,
    the issue is if i use the following command
    SUM(DECODE(EMPLOYEE/CITY/COUNTY_NAME,’Perry’, TO_NUMBER(NVL(EMPLOYEE/RW/FIT_GROSS_WAGES,0)),1))
    it always goes to the else condition and picks 1 even for employee records whose county name is Perry.
    Replacing a value like
    SUM(DECODE(EMPLOYEE/CITY/COUNTY_NAME,’Perry’, 2 ,1))
    then the 2 will be picked up for Perry County employees and 1 picked up for the rest.
    The issue is that in the first command i cannot use TO_NUMBER(NVL(EMPLOYEE/RW/FIT_GROSS_WAGES,0)).

  • Find Tax conditions and amounts while creating a PO from reference.

    Hi friends,
    I am creating a PO from another reference PO. When I create the PO the Tax conditions and
    amounts come from Sabrix 3rd party system. This data gets saved into SAP internal memory and
    is visible when we follow PO item-> Invoice Tab->Taxes-->then we can see Tax
    conditions and there amounts as well. when we press SAVE button PO gets created and KNUMV
    (Condition Number) gets formed and then we can access this Condition types and Amounts data
    from KONV table by specifying the Condition number which is the Primary key of KONV table.
    But we need to access this data of Condition types and Amounts even before we press SAVe
    button on ME21N screen.
    Please help me on this.

    Hi,
    As mentioned that this error was one of the wierdest SAP issues I have faced, it was due to the silliest copy paste errors on my behalf. I completely overlooked the POITEMX naming.
    For 4 values of RFQ_NO, RFQ_ITEM, PREQ_NO, PREQ_ITEM, I didnt have the 'X' for POITEMX and kept on looking for errors for days.
    BAPI_PO_CREATE1 works with min. possible inputs successfully.
    Thanks to all!

  • .   Is it possible to create condition record in both CRM as well as in R/3

    hi,
    .   Is it possible to create condition record in both CRM as well as in R/3?  Explain in more details.
    Regards,
    babu

    Hi Babu,
    No. You cannot create condition records in CRM when back end is R/3.
    Condition records should be created in R/3 and replicated to CRM.
    You cannot extend condition records in CRM.
    Reward the Points.
    Thanks,
    Srini.

  • Sql query with conditions and calculations???

    Hi,
    how I can build a query with conditions and calculations?
    E.g. I've got this table
    Start          | End     |     Working Place     |     Mandatory
    01-JAN-13 | 11-JAN-13 |     Office           |          1
    14-JAN-13 | 25-JAN-13 |     Home Office      |     0
    04-MRZ-13| 15-MRZ-13 |     Office           |          0
    11-FEB-13 | 22-FEB-13 |     Office           |          1
    Now if column working place=Office and column mandatory=0
    the new column "price" has to calculate: (End-Start)* $25.00
    and if working place=Office and column mandatory=1
    the "price" column has to calculate: (End-Start)* $20.60
    else $0.00
    I tried it with the case statement but I didn't know how
    to calculate my values and display it to the virtual column "price".
    Something like
    case
    when Working_Place = 'Office' and Mandatory=1
         then ...
    else '0.00'
    end as PRICE
    Or is it not possible?
    Edited by: DB2000 on 12.03.2013 05:09

    Use CASE:
    select  start_dt,
            end_dt,
            working_place,
            mandatory,
            case
              when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25
              when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60
              else 0
            end price
      from  tbl
    START_DT  END_DT    WORKING_PLA  MANDATORY      PRICE
    01-JAN-13 11-JAN-13 Office               1        206
    14-JAN-13 25-JAN-13 Home Office          0          0
    04-MAR-13 15-MAR-13 Office               0        275
    11-FEB-13 22-FEB-13 Office               1      226.6
    SQL> SY.

  • Freight Conditions and Commission Rate - New Requirement

    Hi All,
    There is new requirement about Freight condition and Commission Rate. Please see below for details:
    I got the requirement lets say:
    They want 3 different types of freight like 1st Freight - based on unit/qty, 2nd freight - Fixed Amount, and 3rd Freight - based on kilometer, out of this 3 any one will applicable in sale order at a time depends how they want to charge. they have existing pricing procedure.
    I hope the above freight related part clear to you all.
    Now the commision part:
    Here they are giving commisions whatever rate decided to the commission agent, here also for commission agent they want 3 different types 1st will be Fixed Amount, 2nd will be based on percentage and 3rd will be normal way.
    Please help and advice how to achieve this type of requirement.

    hi
    Condition Exclusion 
    The system can exclude conditions so that they are not taken into account during pricing in sales documents.
    Material 4711 costs 150 USD. Some customers receive a discount of 10 USD per 100 pieces.
    However, a specific customer can buy the material for 100 USD. Since this is a particularly good price, the customer should not also have a discount of 10 USD per 100 pieces. Therefore, this discount is to be excluded from pricing.
    To do this, you must follow two steps:
    You must set a condition exclusion indicator for the price. You can do this in two ways: If you want to set the condition exclusion indicator a follows then you specify it:
    - for all condition records of a condition type (e.g. with condition type PR00) when defining a condition type in SD Customizing
    - for an individual condition record (e.g. only for material 4711) in the detail screen of a condition record (in the Condition exclusion field)
    You must set a condition for the discount in the pricing procedure in Customizing for sales. If this condition is set, the discount is not valid if the condition exclusion indicator is set. Condition 2 is available in the standard R/3 System.
    The condition exclusion indicator is not valid for condition supplements.
    This means that if a condition record contains condition supplements they will be taken into account during pricing.
    Condition Exclusion Group u2013 
    In any normal situation there could be more than one condition type in a pricing procedure offering a discount to a customer. Should the discounts be automatically determined, there is the risk that the customer will receive all the relevant discounts and thus purchase the product for a lower price than he should.
    By using u2018condition exclusion groupsu2019 you can ensure that the customer does not receive all the discounts, but instead only receives the best of the available discount condition types.
    Menu path u2013 IMG - Sales & Distribution - Basic functions u2013 pricing u2013 condition exclusion u2013 condition exclusion for groups of conditions (OV31).
    A condition exclusion group is merely a grouping of condition types that are compared to each other during pricing and result in the exclusion of particular condition types within a group or entire groups. It is important to note that the condition types you want the system to compare must exist in the pricing procedure and must have valid condition records created for them.
    If for example, a sales order is created using the pricing procedure that the exclusion group is assigned to, you can see that the condition offering the most favorable discount to the customer is represented in the pricing procedure.
    For instance, condition type K007 has offered a discount of 10% off the sale price or a real value of $30, while another condition type K005 has offered a real value discount of $10. The system then takes the best discount for the customer between the two, which is K007 and makes the other discount K005 inactive. This can be seen by double clicking on the condition type K005, where you can find a entry saying u2018Inactive A condition exclusion itemu2019.
    There are four possible methods of using condition exclusion groups u2013 
    A u2013 best condition between the condition types
    B u2013 best condition within the condition types
    C u2013 best condition between the two exclusion groups
    D u2013 exclusive
    E u2013 least favorable within the condition type
    F u2013 least favorable within the two exclusion groups
    Configuring u2018Condition Exclusion Groupsu2019
    First step is to define a u2018condition exclusion groupu2019 by using a four character alpha numeric key.
    Next step is to assign the relevant condition types to the exclusion groups such as discount condition types, freight condition types.
    After completing the assignment of the condition types to the exclusion group, proceed with assigning the condition exclusion group to the relevant pricing procedure.
    After selecting the pricing procedure for which you want the condition exclusion to be active, select the folder u2018Exclusionu2019 where you can assign the relevant condition exclusion procedure to the relevant condition exclusion group.
    When using the condition exclusion group to find the best condition record in a condition type u2013 only use one condition type per exclusion group. The most important thing to remember here is to u201Cdeactivateu201D the Exclusive Indicator on the access sequence assigned to that condition type. Otherwise, the system will merely find the first condition record and stop searching for other records.

  • Start conditions and check function modules

    Hi,
    When we apply start conditions to any particular even linkage you will find check function module as SWB_2_CHECK_FB_START_COND_EVAL. However, what if i want to implement both a custom check function module AND start conditions ?
    My requirement is to implement both start conditions and check function module.
    Is this possible ?
    Thank you,
    Nikhil.

    Hi,
    You can use both of the things, however its advisable to check all start conditions if you are using check FM.
    This is interface for custom  check FM,once you have the key value, you can put all the checks here
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(OBJTYPE) TYPE  SWETYPECOU-OBJTYPE
    *"     VALUE(OBJKEY) TYPE  SWEINSTCOU-OBJKEY
    *"     VALUE(EVENT) TYPE  SWETYPECOU-EVENT
    *"     VALUE(RECTYPE) TYPE  SWETYPECOU-RECTYPE
    *"  EXPORTING
    *"     REFERENCE(REFERENCE) TYPE  C
    *"  TABLES
    *"      EVENT_CONTAINER STRUCTURE  SWCONT
    *"  EXCEPTIONS
    *"      NOT_TRIGGERD
    Hope this helps.
    Regards,
    Sangvir Singh

  • Possible to create detailed and Summary in same crystal report?

    Hello
    I have worked with cyrstal reports back in 2001. Now I am back to creation of reports. I vaguely remember I was able to create summary and detailed reports from one crystal report file. I don't remember if I was using two different stored procedures or not. Can anybody explain if it is possible to create summary and detailed reports from one crystal report file and with one stored procedure. I am guessing somehow I should be able to control behaviour of report - ie. say if user selects detailed report- report will show all records and if user selects summary view then report will show summarized view of same data.
    If its possible how do you do it? Can you explain.
    Thanks a lot.

    There are a couple of techniques with drilling and sub-reports, but what I do most frequently is create a Detail/Summary  parameter for the user to select, and then have a formula that references this parameter to either hide or display a Detail section of the report sepending on the option the user chooses.  My experience is that most users can relate to this approach better, where as driling and sub-reports can sometimes cause confusion for them.

  • Tdms-files: Is it possible to prevent LabVIEW and DIAdem from creating .tdms_index files?

    Hello,
    is it possible to prevent LabVIEW and DIAdem from creating .tdms_index files when opening/creating/editing a .tdms file?
    I think I have no benefit from the .tdms_index files because our applications create a lot of little .tdms-files (repeat measurements). With the additional .tdms_index files we have unnecessary memory consumption and it takes longer for Windows to open the containing folder. Also it´s confusing when searching for a certain file.
    Best Regards
    Daniel
    Solved!
    Go to Solution.

    Hi Baui,
    I'm afraid there's a direct way to disable creating .tdms_index file now from LabVIEW and DIAdem. You can use TDMS Advacend API in LabVIEW, which doesn't create any index file, or you can just make some simple programming and delete the .tdms_index file after closing the TDMS file. 
    This is a request for a long time, we'll consider to add this feature for TDMS in future releases.
    Yongqing Ye
    NI R&D

  • Is it possible to restrict copying and printing a pdf?

    Is it possible to restrict copying and printing a pdf without setting a password? I just want to restrict using the document, but don't want a password-demanding window to pop up.

    Hei guys!
    I truly need your reply!
    Any reply or a hint or a reference to another application is welcome.
    Thank you!

  • TS1702 After installing the new software to my iPhone 4S , my dream zoo either will not start or when it does it has a blank screen that has a few icons on it that wont work. How can I fix this is it possible to go back and reinstall the older software ?

    After installing the new software to my iPhone 4S , my dream zoo either will not start or when it does it has a blank screen that has a few icons on it that wont work. How can I fix this is it possible to go back and reinstall the older software ?

    Unfortunately I tried that and it didn't work. Thanks for the help though. I tried to uninstall and it said I couldn't because the file is corrupt or something, but I think I finally got it uninstalled and/or deleted or whatever, but now I try to reinstall/download it again from the beginning and I can't. No matter what I do I can not get Firefox working again. No matter how many times I try to redownload it. Any other suggestions?

  • TS1901 Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.
    *** ??? I need to take out the data from a WD320 that shows this error and then format the WD and put the data into again
    THANKS !!!

    I'm sorry, is there a question here? You seem to know precisely what you need to do…

  • Can I fix a disk with this message?-Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Can I fix a disk with this message?
    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Some problems can indeed be fixed this way. But working from Recovery_HD or Disk Warrior DVDs and working in the restricted environment those provide can be difficult. You can literally spend days working on this problem (while your regular work is unavailable) only to discover the old drive is unsalvageable.
    There is no way to know up front whether you are facing a major Hardware failure or a minor software glitch, or something in between. Often you are forced to work from the drive you no longer trust. I continue to recommend you do this work from a different, fully functioning Mac OS X booted from a different drive.
    If you have had the foresight to (as The hatter often recommends) clone your virgin install onto another drive for use in such situations, you will be able to recover from such problems in record time. If not, my previous recommendations stands:
    Buy a new Drive. Or  two. Install Mac OS X from scratch on a new drive, and get your Mac running again. Later, you can use the full power of Mac OS X to attempt to rescue your data, if needed. Then Zero the old drive, to see if it can hold data again reliably.
    If the old drive eventually provides some needed data, and is salvageable, Merry Christmas.

  • Please a simple problem but I don't know how to solve it. After installing 16 gb of ram all is good but when I turn on the computer it is a window signaling that all is correct. How is possible to delete once and for all that window? Thank you

    Please a simple problem but I don't know how to solve it. After installing 16 gb of ram all is good but when I turn on the computer it is a window signaling that all is correct. How is possible to delete once and for all that window? Thank you

    Well then maybe you could take a screenshot because the appearance of such a window is news to me.
    Also post your OS X version and what model Mac you have. The more detail, the better. Thanks.
    To take a screenshot hold ⌘ Shift 4 to create a selection crosshair. Click and hold while you drag the crosshair over the area you wish to capture and then release the mouse or trackpad. You will hear a "camera shutter" sound. This will deposit a screenshot on your Desktop.
    If you can't find it on your Desktop look in your Documents or Downloads folder.
    When you post your response, click the "camera" icon above the text field:
    This will display a dialog box which enables you to choose the screenshot file (remember it's on your Desktop) and click the Insert Image button.
    ⌘ Shift 4 and then pressing the space bar captures the frontmost window.
    ⌘ Shift 3 captures the entire screen.
    Drag the screenshot to the Trash after you post your reply.

Maybe you are looking for