Could we have an IF statement within a CASE please in FMS Queries?

What is wrong with this query please. It complains over Begin statement.
select
(case
when $[RDR1.U_DepFeeState.0]='ON' then
if ($[RDR1.UseBaseUn]='No' )
    begin
         t0.U_DepoistfeeON$[$38.10002117.377]1
    end
else
         t0.U_DepoistfeeON$[$38.10002117.377]1
when $[RDR1.U_DepFeeState.0]='QC' then t0.U_DepositfeeQC*$[$38.10002117.377]
when $[RDR1.U_DepFeeState.0]='AB' then t0.U_DepositfeeAB*$[$38.10002117.377]
else 0
end)
from oitm t0 where T0.ItemCode = $[$38.1.0]
Thanks.

No Begin End under CASE.
Try this:
SELECT
(case
when $[RDR1.U_DepFeeState.0]='ON' then
t0.U_DepoistfeeON*$[$38.10002117.number]
when $[RDR1.U_DepFeeState.0]='QC' then
t0.U_DepositfeeQC*$[$38.10002117.number]
when $[RDR1.U_DepFeeState.0]='AB' then
t0.U_DepositfeeAB*$[$38.10002117.number]
else 0
end)
FROM dbo.oitm t0 where T0.ItemCode = $[$38.1.0]
Thanks,
Gordon

Similar Messages

  • Possible to have if statement within filters code?

    Hi
    I have some filters set up, and have assigned some global vars to them, which I then use in my Filters code to display the filters:
    myText:Filters [globals.data.glow1, globals.data.stroke1, globals.data.shad1]
    Works perfectly.
    Now I want to assign a global var to each global filter var to determine if it should be shown or not.  So...
    globals.data.glow1On = true;
    globals.data.stroke1On = true;
    globals.data.shadOn = true;
    ... and then somehow incorporate these new vars into an if conditional to determine if the filter global vars get included in the myText:Filters code.
    However, I cannot seem to code the if conditional into the myText:Filters code correctly.
    I even tried seperating it out like so:
    if (globals.data.glow1On = true) {myText:Filters [globals.data.glow1];
    if (globals.data.stroke1On = true) {myText:Filters [globals.data.stroke1];
    if (globals.data.shad1On = true) {myText:Filters [globals.data.shad1];
    But Flash only makes the last filter true (kinda makes sense to me now why).
    Is there a way to do it without having to make an if conditional with 7 permutations?
    Cheers
    Shaun

A: Possible to have if statement within filters code?

You are not coding the conditional properly.  "=" is for assignment, "==" is for comparing equality.
if (globals.data.glow1On == true) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On == true) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On == true) {myText:Filters [globals.data.shad1];
Also, a conditional evaluates whether or not something is true, so for Boolean values you do not need to explicitly compare them...
if (globals.data.glow1On) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) {myText:Filters [globals.data.shad1];
Lastly, for what I see that you showed, the conditionals are all missing their closing brackets, and while you can use them, the brackets are not needed for single command conditionals...
if (globals.data.glow1On){ myText:Filters [globals.data.glow1]; }
if (globals.data.stroke1On){ myText:Filters [globals.data.stroke1]; }
if (globals.data.shad1On){ myText:Filters [globals.data.shad1]; }
OR
if (globals.data.glow1On) myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) myText:Filters [globals.data.shad1];

You are not coding the conditional properly.  "=" is for assignment, "==" is for comparing equality.
if (globals.data.glow1On == true) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On == true) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On == true) {myText:Filters [globals.data.shad1];
Also, a conditional evaluates whether or not something is true, so for Boolean values you do not need to explicitly compare them...
if (globals.data.glow1On) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) {myText:Filters [globals.data.shad1];
Lastly, for what I see that you showed, the conditionals are all missing their closing brackets, and while you can use them, the brackets are not needed for single command conditionals...
if (globals.data.glow1On){ myText:Filters [globals.data.glow1]; }
if (globals.data.stroke1On){ myText:Filters [globals.data.stroke1]; }
if (globals.data.shad1On){ myText:Filters [globals.data.shad1]; }
OR
if (globals.data.glow1On) myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) myText:Filters [globals.data.shad1];

  • Could I have CASE or IF statement in FMS queries?

    Is it possible to have case statements in FMS queries:
    For example:
    SELECT T0.[U_DepoistfeeON] case
          when T0.[U_DepoistfeeON] is NOT BLANK  then $[$38.111.160]='Deposit Fee'
          when T0.[U_DepoistfeeON] is BLANK  then  then $[$38.111.160]=BLANK
    end FROM OITM T0
    What is wrong with above query please? Thank you very much.
    I do not mind even if above query is doable with an IF statement in it.

    Hi Rahul, this is what I want -
    I have a user defined field attached to item master OITM. The field is called : U_DepoistfeeON
    The above field contains additional depositFee taxes for selling beer bottles.
    I have also created a new tax as part of Freight handling. While on Sales Order screen, the Freight (unhide first through forms field) drop down can have the new tax type selected automatically "Deposit Fee".
    Thus, if the line item is of beer type that has U_DepositfeeON, then Freight field should automaticlally pick the type "Deposit Fee".
    If U_DepositfeeON is zero then I would like the Freight field on Sales Order screen ($38.111.160) set to blank.
    I tried to achieve this through following using case statement.
    select T0.U_DepoistfeeON
    from oitm t0
    case
    when T0.U_DepoistfeeON 0
    then $http://$38.111.160='Deposit Fee'
    when T0.U_DepoistfeeON = 0
    then $http://$38.111.160=''
    else
    $http://$38.111.160=''
    end;
    Of course it doesn't work. Note: I know I typed in DepoistfeeON, the error is not due to that.
    Thanks.

  • If statement within a view is not working correctly ?

    Hi all,
    maybe i am wrong but i think the if statement within a view is not working correctly. See code down below.
    I would like to use the Hallo World depending on the page attribute isFrame with or without all the neccessary html tags. Therefore i have embedded the htmlb tags in an if statement. But for any reason if isframe is initial it isn't working. It would be great if anybody could help me.
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if not isframe is initial. %>
      <htmlb:content design="design2003">
         <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    hallo world
    <% if not isframe is initial. %>
         </htmlb:page>
      </htmlb:content>
    <% endif. %>
    thanks in advance and best regards
    Matthias Hlubek

    Matthias,
    The short answer: your example is <b>NOT</b> going to work. The long answer will probably 5 pages to describe. So first let me rewrite the example so that it could work, and then give a short version of the long answer. Do not be disappointed if it is not totally clear. It is rather complicated. (See the nice form of IF statements that are possible since 620.)
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if isframe is <b>NOT</b> initial. %>
    <htmlb:content design="design2003">
      <htmlb:page title = "Top Level Navigation view">
        hallo world
      </htmlb:page>
    </htmlb:content>
    <% else. %>
      hallo world
    <% endif. %>
    So why does your example not work? Let us start with a simple tag:
      <htmlb:page title = "Top Level Navigation view">
      </htmlb:page>
    Now, for each tag, we have effectively the opening part (<htmlb:page>), an optional body, and then the closing part (</htmlb:page>). We are now at the level of the BSP runtime processing one tag. What the runtime does not know, is whether the tag wants to process its body or not. Each tag can decide dynamically at runtime whether the body should be processed. So the BSP compiler generates the following code:
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
      ENDIF.
      tag->DO_AT_END( ).
    You should actually just debug your BSP code at ABAP level, and then you will immediately see all of this. Now, let us mix in your example with our code generation. First you simplified example:
    <% if isframe is NOT initial. %>
      <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    <% if isframe is NOT initial. %>
      </htmlb:page>
    <% endif. %>
    And then with our generated code. Look specifically at how the IF/ENDIF blocks suddenly match!
    if isframe is NOT initial.
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
    endif.
    if isframe is NOT initial.
      ENDIF.
      tag->DO_AT_END( ).
    endif.
    You can see that your ENDIF statements are closing IF blocks generated by the BSP compiler. Such a nesting will not work. This is a very short form of the problem, there are a number of variations, and different types of the same problem.
    The only way to solve this problem, is probably to put the body into a page fragment and include it like I did above with the duplicate HelloWorld strings. But this duplicates source code. Better is to put body onto a view, that can be processed as required.
    brian

  • Could I have got a new power adapter for free?

    My power adapter for my mac stopped working recently and as far as I know I didn't cause any damage to it myself.
    I read the following on the apple website:
    Additional Information
    Whether your product is in or out of warranty, you can take your adapter to an Apple Authorized Service Provider or Apple Retail Store for evaluation and replacement if necessary. Pending the results of evaluation, you may or may not be eligible for a replacement adapter free of charge. Signs of accidental damage would negate any coverage. Be sure to bring in the computer used with the adapter; it is required to process potential adapter replacements.
    Which seems to suggest that even out of warrenty, if the charger has broken of it's own accord you can still get a free replacement?
    I took my adapter and mac to the shop, they said there were no signs of accidental damage but said I still have to pay for it. I referred to this statement from the website but they were very dismissive and kept saying it was out of warrenty. Perhaps i'm reading the statement wrongly.
    Just wondered if anyone could clarify :-)

    As you indicated, it depends on the results of the evaluation.
    Apple takes responsibility when design faults cause certain failures, especially when it represents a safety concern. There have been a small number of cases where failure met certain characteristics that Apple deemed that it should not have happened, regardless of age or use.
    I am reluctant to indicated the specificity of some of these issues, because for many reasons Apple would not want us speculating on the subject. Suffice it to say your product failure may not have met any particular characteristics associated with failures deemed to have extended coverage.
    If your product failed for an unknown reason, or apparently a failure stemming from age or normal life expectancy use, and it was after the normal expiry of warranty, then no further consideration was given. You need to buy and pay for a new one, unless you yourself, can provide extenuating circumstances to consider.

  • Using a different default component state within each page state

    I am using a custom component in multiple page states but would like to have a different default state (for the same custom component) within each page state.
    Is there anyway to use a different default component state within each page state .
    When I change the default state at a component level it seems to go across all my page states.  Any solutions?
    Thank you

    I guess I can just add that interaction for that component!
    I think my brain is just catching up

  • I bought my little brother an iPod touch 2nd generation for Xmas so we could text since we love states away but it won't verify and complete updating so I can download the texting apps required by iOS 4 or later can someone tell me how to update it please

    I bought my little brother an iPod touch 2nd generation for Xmas so we could text since we love states away but it won't verify and complete updating so I can download the texting apps required by iOS 4 or later can someone tell me how to update it please

    What exactly happens when you try to update the iPod? What does the error message say?
    Also, are you sure yo have a 2G iPod?
    See:
    Identifying iPod models
    I ask since a 1G can only go to iOS 2.x via iTunes and highest is 3.1.3 via
    Purchasing iOS 3.1 Software Update for iPod touch (1st generation)

  • Multiple statements within an if statement

    I am trying to add multiple statements within the ELSE part of an IF statement. Basically I display an error message if the fields are blank.  But if all conditions are met, I want to update a collection then save that collection.
    For example,
    If  (condition, UpdateContext({strError:"Please complete all fields."}), do statement1, statement2)
    For now I have removed the if statement to get the update collection and save collection to work.

    I am trying to add multiple statements within the ELSE part of an IF statement. Basically I display an error message if the fields are blank.  But if all conditions are met, I want to update a collection then save that collection.
    For example,
    If  (condition, UpdateContext({strError:"Please complete all fields."}), do statement1, statement2)
    For now I have removed the if statement to get the update collection and save collection to work.
    I may have found a workaround with multiple buttons.
    If a save button if pressed and all fields are completed, then the else part of the statement display a rectangle with two buttons, yes and no.  I can add all my code to the yes button select section.  the no button hides the rectangle and buttons.
    However, I would still like to know hos to utilize multiple statements within an if.  Any comments would be greatly appreciated.

  • I don't know what i need. I'am a mac user but i need to run quick books premier. This is the only software i need in windows 7. Could i have some advise in  what is better for me, Bootcamp or parallels

    I don't know what i need. I'am a mac user but i need to run quick books premier. This is the only software i need in windows . Could i have some advise in  what is better for me, Bootcamp or Parallels

    The Intuit rep said they don't "support" QuickbooksPremier on a "virtual machine." Do you know what I risk by using it, anyway? thanks for the advice about Boot Camp vs Parallels, BTW!
    I use QuickBooks Pro for Mac, so I haven't had need to try any of the Windows versions in a VM. But I can't think why it wouldn't work. From within the VM, QuickBooks Premier would believe it is operating on PC hardware within Windows.
    I would guess they mean that the multiple user support wouldn't work from within the VM. But I would think that would also work. Windows can see the Internet from within the VM, which means it can see your network. So if Windows can see the network, then QB Premier should be able to, too.
    I know you can get Parallels as a demo, and maybe you could get QB Premier as trial software. So if you already have a retail copy of Windows to load into a VM, it would only cost you time to test what's possible.

  • How to persist af:table column sort state within a session?

    Hi,
    I have an af:table in my page with the columns sortable="true".  So when click on the header of any column, we can sort the column.  Our users have a requirement that after they do the sort by clicking one of the column headers in the af:table, then they navigate to another page in our application and then come back to this page, they want to see the same sort order of data.  How can we persist the sorting state in af:table?
    Any comments are appreciated.
    Thanks
    -Mina

    Hi,
    I am not sure this is doable because the underling data collection may be changed on other views. You can use a sort listener and intercept the sort order selected by a user to persist it in the session or else where (keep in mind that using the panelCollection component you could also have a sort order that spans multiple columns). When you navigate back to the view you then have the information to order the data accordingly.
    Frank

  • How could I find the SQL statement who get this message ?

    ORA-01555 caused by SQL statement below (Query Duration=11191 sec, SCN: 0x0854.723b9c32)
    ... How could I find the SQL statement who got this message ?
    Thanks, Paul

    ORA-01555 means that the UNDO/ROLLBACK space is not large enough.
    This occurs because the SELECT statement is attempting to read the UNDO, but the UNDO has been released (transactions have committed or rolled back) and reused.
    The following are SOME of the reasons I have seen this to occur:
    1) Updates in a loop, with commits happening in the same loop
    - this will mark the UNDO available quickly and quickly reuse it. Then when the SELECT wants to rebuild a block, the UNDO used to rebuild the block has been reused (solution, make the UNDO bigger)
    2) A SELECT cursor used to control a loop in which updates are performed, and a 'done' flag is marked against the current cursor record, and commits are performed at the end of each loop, prior to fetching the next record
    - same problem as above, but it hits the current process. Same solution
    3) A 'month end' activity spike occurs, and all sorts of transactions create updates. There is a report that reports the activity - amusingly it needs to start at the beginning of all the work and updates periodically by doing a huge SELECT up front. This is then used to drive a loop which attempts to get information from the various transactions that have been updated and committed. After a while, the SELECT gets an ORA-01555
    - same problem as above and same solution. Get a bigger UNDO segment.
    You say this only happens once a month. That should give a hint.
    I wouldn't bother with which SELECT statement, as much as which APPLICATIONs are being run when it happens.
    One way around this - use 10g and set the guaranteed retention period. All sorts of other things will break, by no more 1555. <g>

  • Why doesn't U-verse have out of state local channels?

    Dish Network has out of state local channels. Why doesn't U-verse have out of state local channels?

    That Don Guy wrote:
    I can think of a couple of reasons.
    First, if U-Verse had to carry every channel everywhere - even if it was just limited to its service areas (so, for example, there would be no local channels from Seattle available) - imagine how many channels that would require.
    Second, and probably the real reason, is something called "broadcast exclusivity."  The short version is, each network affiliate has an area over which it is supposed to be the only station that shows a network's programs - for example, viewers in Los Angeles should be able to get ABC shows only on KABC.  This makes sure that people in that area will watch that station - and, more importantly for the station, its local commercials.  I am under the impression that there is a similar rule involving syndicated programming - for example, two different stations in the same area can't show Wheel of Fortune or repeats of Modern Family.  (For some reason, I have seen this implemented differently on different systems; for example, when I lived near Travis Air Force Base, about halfway between San Francisco and Sacramento, I got both cities' stations for all four major networks on Xfinity.)  This would be almost impossible to enforce if every household got every channel, as it has to be handled on a city-by-city basis.
    There's also the problem of time zones - I don't think network affiliates in the Pacific time zone would like it if people could watch the network's Eastern or Central time zone affiliates and see the shows three hours earlier.
    And I haven't even mentioned sports exclusivity yet.  Remember, the NFL has a rule where the city hosting a Sunday afternoon game cannot show any other game on TV at the same time (there used to be exceptions when the game was blacked out, but the NFL has gotten rid of its blackout rule for the 2015 season).  I seriously doubt the NFL would allow U-Verse to get around this by letting every U-Verse subscriber watch their choice of evert CBS and Fox station.
    That reminds me of a particular situation from 2001-2002 that I was in:
    My local FOX affilliate used to show Simpsons repeats at 5 and 5:30. There is a channel out of Cleveland that was available on Time Warner Columbus (later Mid-Ohio) that would also show Simpsons repeats at 6 and 6:30. Well, about 3-4 counties east of Columbus, it was the same TW lineup as in Columbus (with an exception to have two NBC affiliates, Columbus and a nearby city), but they had the full two hours of Simpsons. Travel to Columbus and you only got the first hour.
    The odd thing? That second hour started more like 5:58 PM and the blackout infomercials didn't come on until 6...just enough time for me to tell what episode it was.
    And since the episodes were all basically picked by the local station, sometimes there was a case of "We just saw that episode a few days ago!"
    The Cleveland station would sometimes dig a little "deeper" into the archives which was nice.

  • I can see less than 5 percent of my music from the iTunes 12 on my Macbook Air.  What could I have changed to lose almost everything?

    Here are the stats:  From my Mac Mini where I keep physical copies of everything: 43 genres, 706 artists, 1477 albums, 17719 songs.  On my Macbook (same new version of iTunes) 9 genres, 52 artists, 59 albums and 611 songs.  What could I have done to make my iCloud content invisible and inaccessible?  I paid up and the setup looks normal.
    The system is completely up-to-date running all of the latest available versions and patches for IOS X 10.10.2
    Help would be appreciated.
    Thanks,
    Joe

    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    As you will have discovered, the music sync is only one way, from iTunes to the iPod, minus iTunes purchases.  On top of that, an iPod is designed to sync with only one iTunes library at a time.
    B-rock

  • When i login to yahoo, my first click results in the spinning wheel. Could i have a virus Or why does it only happen when i login to yahoo?

    When i login to yahoo, my first click results in the spinning wheel. Could i have a virus? Or why does it only happen when i login to yahoo?

    Firefox allows to select part of a word. You can select a word with a double click and use Shift + left click to set the end of the selection, so you need to click at the end of the last word instead of in it.

  • Could I have purchased an i7 13" MBP non-retina in-store?

    Hey everyone!
    Back in October, I purchased the 13" non-retina display MBP at my nearest Apple Store. I really wanted to get the higher-end i7 version (as it was listed on the website) but, I wasn't asked if I wanted to configure it to higher specs when I was in-store. At the time, I was only given the option between the retina and non-retina model so I went with the non-retina because it was cheaper but, I found out it only had an i5 processor. Now, I'm kinda stuck with the lowest-end mid-2012 MBP.
    So, is configuring a MacBook Pro an online-only thing or could I have configured it in-store?

    Hi d,
    From everything I've ever read, seen, heard and experienced, you have to do a build-to-order Mac online, so don't beat yourself up.

  • Maybe you are looking for

    • I have a new apple ID how do I get my new purchases to my normal itunes library

      So I have a ipad and an ipod nano. I have always downloaded music on my ipad then synced my ipod to my pc. But i had to get and new apple ID. So when I got to sync my ipod. It does it with my old account. Ive tried deleting itunes and redownloading i

    • SDM Error while deploying from IDE

      Hi I am getting an error while deploying from IDE. -- Server XXX did not accept login request as admin on port 50018.Details: ERROR: Could not establish connection to server XXX at port 50018: XXX This problem has been discussed herein SDN earlier.I

    • Transport document attached to infoobject from development to qualification

      Hi Experts, I am facing issues with transporting document attached to one infoobject. I tried to transport this by going into RSA1-documents-attributes and taking the logical and physical ID's. But it did not work. I tried transnporting the table ent

    • Please help. can't get definition around a text. pulling out my hair :(

      hi. i was following a tutorial to give text a 3D effect. the tutorial is located here: http://www.illustratortechniques.com/3d-text-effect.html i am only two steps in and did exactly what was told but my text effect looks different than his. his text

    • More on the modem on hold issue

      I'm having a little trouble wrapping my mind around this. I have a script that involves AppleOnHoldModem.app If certain conditions occur while the script it running, that app is most likely generating information which I'd like to capture, I would gu