If..then..else statement in SQL with 'generalized' conditions in the if sta

it is possible to write something approaching an if..then..else statement in SQL with 'generalized' conditions in the if statement.
Attached is the query for the payment register, in which I've written a series of decode statements, one for each possible value of the payment code. The query works OK - however, its specific and as the number of paycodes expand (and they do), the report won't pick up the new paycode until the code is changed. More importantly, the report won't be correct until someone 'discovers' that a paycode is missing, which might take months.
If I were writing the equivalent of this series of decode statements in Focus, it would be something like this:
DEFINE.......
PAYMED/D12.2 = IF PAYMENT_CD LE 18
               THEN PAYMENT_AMT
               ELSE 0 ;
PAYIND/D12.2 = IF PAYMENT_CD GE 19 AND PAYMENT_CD LE 49
               THEN PAYMENT_AMT
               ELSE 0 ;
PAYEXP/D12.2 = IF PAYMENT_CD GE 70
               THEN PAYMENT_AMT
               ELSE 0 ;
PAYREC/D12.2 = IF PAYMENT_CD GE 50 AND PAYMENT_CD LE 69
               THEN PAYMENT_AMT
               ELSE 0;
END
IN SQL/PLUS:
SELECT ACCOUNT_NAME,
LOCATION_1,
CLMNT_LAST_NAME,
CLAIM_NBR,
DATE_OF_INJURY,
DATE_CHECK_REGISTER,
PAYEE_NAME_1,
PAYMENT_CD,
SERV_OFC,
CPO_CHECK_NBR,
PAYMENT_FORM,
DECODE(PAYMENT_CD, 20, PAYMENT_AMT, 21, PAYMENT_AMT,
22, PAYMENT_AMT, 23, PAYMENT_AMT, 25, PAYMENT_AMT,
26, PAYMENT_AMT, 27, PAYMENT_AMT, 28, PAYMENT_AMT,
29, PAYMENT_AMT, 30, PAYMENT_AMT, 31, PAYMENT_AMT,
32, PAYMENT_AMT, 33, PAYMENT_AMT, 34, PAYMENT_AMT,
35, PAYMENT_AMT, 36, PAYMENT_AMT, 37, PAYMENT_AMT,
39, PAYMENT_AMT, 40, PAYMENT_AMT, 41, PAYMENT_AMT,
42, PAYMENT_AMT, 43, PAYMENT_AMT, 44, PAYMENT_AMT,
45, PAYMENT_AMT, 46, PAYMENT_AMT, 47, PAYMENT_AMT,
48, PAYMENT_AMT, 49, PAYMENT_AMT, NULL) INDEMNITY,
DECODE(PAYMENT_CD, 0, PAYMENT_AMT, 1, PAYMENT_AMT,
2, PAYMENT_AMT, 3, PAYMENT_AMT, 4, PAYMENT_AMT,
5, PAYMENT_AMT, 6, PAYMENT_AMT, 7, PAYMENT_AMT,
8, PAYMENT_AMT, 9, PAYMENT_AMT, 10, PAYMENT_AMT,
11, PAYMENT_AMT, 12, PAYMENT_AMT, 13, PAYMENT_AMT,
14, PAYMENT_AMT, 15, PAYMENT_AMT, 18, PAYMENT_AMT,
17, PAYMENT_AMT, NULL) MEDICAL,
DECODE(PAYMENT_CD, 70, PAYMENT_AMT, 71, PAYMENT_AMT,
72, PAYMENT_AMT, 73, PAYMENT_AMT, 74, PAYMENT_AMT,
75, PAYMENT_AMT, 76, PAYMENT_AMT, 77, PAYMENT_AMT,
78, PAYMENT_AMT, 79, PAYMENT_AMT, 80, PAYMENT_AMT,
81, PAYMENT_AMT, 82, PAYMENT_AMT, 83, PAYMENT_AMT,
84, PAYMENT_AMT, 85, PAYMENT_AMT, 86, PAYMENT_AMT,
87, PAYMENT_AMT, 88, PAYMENT_AMT, 89, PAYMENT_AMT,
90, PAYMENT_AMT, NULL) EXPENSES,
DECODE(PAYMENT_CD, 50, PAYMENT_AMT, 51, PAYMENT_AMT,
52, PAYMENT_AMT, 53, PAYMENT_AMT, 54, PAYMENT_AMT,
55, PAYMENT_AMT, 56, PAYMENT_AMT, 57, PAYMENT_AMT,
58, PAYMENT_AMT, NULL) RECOVERIES,
DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH,
DATE_FROM_SERVICE,
DATE_THRU_SERVICE
FROM &INPUT_TABLES
WHERE &SECURITYCOND
DATE_OF_PAYMENT BETWEEN :START_DATE AND :END_DATE
ORDER BY LOCATION_1, CPO_CHECK_NBR
As you can see, this is both much easier to write and covers the possibility of expansion of paycodes (expansions always fit in these defined ranges).
My question is, then, is it possible to write something like this in SQL and, if so, could you give me some sample code? (I'm one of those people who learn best from looking at the code as opposed to a set of instructions)

Here is one way you could do it.
Create a table that has columns like:
Payment_code varchar2(2),
Effective_Date Date,
Payment_type varchar2(20),
Expiration_Date Date)
Payment type for example could be
I- indemnity
M- medical
R- recovery
E- expenses
Let the table name for example be PAYMENT_CODE.
The select query would look like
SELECT ACCOUNT_NAME,
LOCATION_1,
CLMNT_LAST_NAME,
CLAIM_NBR,
DATE_OF_INJURY,
DATE_CHECK_REGISTER,
PAYEE_NAME_1,
PAYMENT_CD,
SERV_OFC,
CPO_CHECK_NBR,
PAYMENT_FORM,
DECODE(p.payment_type,'E',PAYMENT_AMOUNT,0) expenses,
DECODE(p.payment_type,'I',PAYMENT_AMOUNT,0) indemnity,
DECODE(p.payment_type,'M',PAYMENT_AMOUNT,0) Medical,
DECODE(p.payment_type,'R',PAYMENT_AMOUNT,0) recoveries,
DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH
FROM &INPUT_TABLES,
PAYMENT_CODE P
WHERE P.PAYMENT_CODE = SOMEINPUT_TABLE.PAYMENT_CODE
and other conditions
The idea is to group all the payment codes into a few groups to reduce the clutter. If there is ever a change to the payment code, you could modify the table and it will be reflected in your select query.

Similar Messages

  • Inserting a 'null' value in an IF THEN ELSE statement

    Greetings,
    I'm using Business Object webi XiR3
    I'd like to return a 'null' value in certain cases for an IF THEN ELSE statement.  Depending on if I format the field as a text or a number, I can return blanks ("") and zeros (0).  However, what I really need to do is leave the field / column formatted as a number and return a 'null' value.  You can see the variable below ... this will return a blank but the column is text.
    Suggestions?
    thanks.
    variable:
    =If([Comp Rate Mid] = 0 And( ([Market Rate 50th].085) - [Annual Total Targeted Comp] >=0) ; ([Market Rate 50th]0.85) - [Annual Total Targeted Comp]; If([Comp Rate Mid] <> 0 And( ([Comp Rate Mid] 0.85) - [Annual Total Targeted Comp] >=0) ; ([Comp Rate Mid]0.85) - [Annual Total Targeted Comp];""))

    I don't think this is possible using a formula, as formulas deal with content, and images can be placed in cells only as 'image fill', which is Format, rather than Content.
    Might be possible using an AppleScript, but I'm not the person to advise you on that.
    Regards,
    Barry

  • How to total 2 colums with an -If then else- statement each

    Hello,
    I have 2 colums A en B who generate data based on an “If then else” statement.
    Colum A
    <?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
    Colum B
    <?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
    Colum C needs to be the sum of both. Who can help me?
    Thanks a lot.

    Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
    Thanks,
    Bipuser

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

  • Java If/Then/Else Statement

    Hello,
    Just wondering if it is possible to call one java file from within another.
    I'm thining wiht an if.then/else statement similar to
    If x==true
    then run file1.java
    else run file2.java
    any examples of this, or if it is even possible would be appreciated.

    This is something like what I would do.
    public class FileRunner {
        public static void main(String [] args) {
            if ( args[0].equals("file1") {
                File1 file1 = new File1();
                file1.init() //method you define in File1 that runs everything that would've been in the File1's main method
            } else if (args[0].equals("file2") {
                File2 file2 = new File2();
                file2.init() //method you define in file2 that runs everything that would've been in the File2's main method
            } else {
                System.err.println("Invalid argument");
                System.exit(1);
    java.exe FileRunner.class file1
    java.exe FileRunner.class file2The other method is to start a new jvm from within java, but that gives you less control than this imo.

  • Usage of exists in if-then-else statements

    please correct the mistakes in this procedure regarding exists in the use of if then else statement .as i am new to oracle i am unable to do it.
    errors are statement ignored
    exists should be inside the statement;
    CREATE or replace FUNCTION CHECK_FG_Id
    p_LegacyDocumentId VARCHAR2,
    p_LegacyFGroupId VARCHAR2,
    p_TransmissionId INTEGER
    RETURN INTEGER as
    BEGIN
    IF EXISTS
    (Select FG.ControlNo from functionalgroup FG,document D
    WHERE FG.DocumentId=D.Id AND D.TransmissionId=p_TransmissionId
    AND FG.ControlNo=p_LegacyFGroupId AND D.ControlNo=p_LegacyDocumentId ) THEN
    Return 1;
    ELSE
    Return 0;
    END IF;
    end;

    Lots of different ways...One way is as follows:
    CREATE OR REPLACE FUNCTION check_fg_id (
    p_legacydocumentid VARCHAR2,
    p_legacyfgroupid VARCHAR2,
    p_transmissionid INTEGER) RETURN INTEGER AS
    vDoesItExist NUMBER;
    BEGIN
    SELECT COUNT (1)
    INTO vdoesitexist
    FROM functionalgroup fg,
    document d
    WHERE fg.documentid = d.ID
    AND d.transmissionid = p_transmissionid
    AND fg.controlno = p_legacyfgroupid
    AND d.controlno = p_legacydocumentid;
    IF vDoesItExist > 0 THEN
    RETURN 1;
    ELSE
    RETURN 0;
    END IF; /** vDoesItExist > 0 **/
    END check_fg_id;

  • Has anyone else been having trouble with safari ever since the update? I have restarted several times,mans it still doesn't work.

    Has anyone else been having trouble with safari ever since the update? I have restarted several times, it still doesn't work.

    Greetings Blueleoapple,
    After reading your post, it sounds like you are experiencing an error with Safari. You may want to consider resetting your device, which is different from restarting. This article provides detailed instructions for Restarting, and Reseting:
    Restart or reset your iPhone, iPad, or iPod touch - Apple Support
    How to restart
    Press and hold the Sleep/Wake button until the red slider appears.
    Drag the slider to turn your device completely off.
    After the device turns off, press and hold the Sleep/Wake button again until you see the Apple logo.
    How to reset
    You should reset your device as a last resort and only if you can't restart it.
    To reset, press and hold both the Sleep/Wake and Home buttons for at least 10 seconds, until you see the Apple logo.
    Thank you for contributing to Apple Support Communities.
    Best,
    Bobby_D

  • Help with setting a condition (if-then-else statements)

    Hello,
    In the following data template I am trying to create a condition for
    SUMAMOUNTPERKELEASE when cs_countfund > 1 in my rtf template.
    <dataTemplate dataSourceRef="xmlpdemo" name="cs_ar_kelease">
         <dataQuery>
              <sqlStatement name="Q_1">
                   <![CDATA[
    select     fm.ke
    ,     ltrim(to_char(fm.ke,'000')) || '-'
    ||     ltrim(to_char(fm.lease#,'000000')) || '-'
    ||     ltrim(to_char(fm.lse_code,'00')) kelease
    ,     fm.ar_doc# ar_doc
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    ,     sum(decode(trancode,
              10, fd.amount,
              420, fd.amount,
              421, fd.amount,
              100, fd.amount*-1,
              101, fd.amount*-1,
              102, fd.amount*-1,
              109, fd.amount*-1,
              110, fd.amount*-1,
              112, fd.amount*-1,
              120, fd.amount*-1,
              121, fd.amount*-1,
              122, fd.amount*-1,
              130, fd.amount*-1,
              230, fd.amount*-1,
              0 )) amount
    from     finhist_main fm
    ,     rolodex ro
    ,     finhist_detail fd
    where     fd.fund <> 999
    and     fd.sub <> 99
    and     fm.status not in (106,110,120)
    and     fd.trancode <> 11
    and     fm.ar_doc# < 9000000
    and     fm.rolodex# = ro.rolodex#
    and     fm.lse_code = fd.lse_code
    and     fm.lease# = fd.lease#
    and     fm.ke = fd.ke
    and     fm.ar_doc# = fd.ar_doc#
    group by     fm.ke
    ,     fm.lease#
    ,     fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    order by     fm.ke, fm.lease#, fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_ke" dataType="varchar2" source="Q_1">
                   <element name="ke" dataType="number" value="KE"/>
                   <element name="SumamountPerke" function="sum" dataType="number" value="G_fund.amount"/>
                   <group name="G_kelease" dataType="varchar2" source="Q_1">
                        <element name="kelease" dataType="varchar2" value="KELEASE"/>
                        <element name="ar_doc" dataType="number" value="AR_DOC"/>
                        <element name="lname" dataType="varchar2" value="LNAME"/>
                        <element name="billed_from" dataType="date" value="BILLED_FROM"/>
                        <element name="billed_thru" dataType="date" value="BILLED_THRU"/>
                        <element name="due_date" dataType="date" value="DUE_DATE"/>
                        <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
                        <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>                    <group name="G_fund" dataType="varchar2" source="Q_1">
                             <element name="fund" dataType="number" value="FUND"/>
                             <element name="sub" dataType="number" value="SUB"/>
                             <element name="amount" dataType="number" value="AMOUNT"/>
                        </group>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
    <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>     
    I have tried the following conditions in the text form field for SUMAMOUNTPERKELEASE
    <?if:cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end if?>
    <?xdofx: if :cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?xdofx: if cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?choose:?>
    <?when: cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end when?>
    Nothing seems to work. Help...
    Any suggestions would be greatly appreciated.
    Susie

    Hi,
    I assume that in your resulting XML CS_countfund is written in uppercase.
    So try
    <?if:CS_COUNTFUND > 1?>
    <?SUMAMOUNTPERKELEASE?>
    <?end if?>
    Regards
    Rainer

  • Strange issue when running sql with false condition

    Hi,
    I'm running this query from the application:
    select 22
    from DUAL
    where ( to_number(0) <> 0 ) and exists (
    select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(0) ) );
    And it takes a long time because it is checking the second condition.
    Even though the first one is False.
    When running it through sqlplus it takes nothing. and of course no rows returns.
    The 0 in to_number is a bind variable
    it looks like this:
    select :intvar
    from DUAL
    where ( to_number(:QIV$) <> 0 ) and exists ( select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(:QIV$) ) )
    1 - filter predicate: ( IS NOT NULL AND 0<>TO_NUMBER(TO_CHAR(:QIV$)))
    But in sqlplus the filter predicates is different.
    1 - filter(NULL IS NOT NULL AND EXISTS (SELECT 0 FROM "TABULA"."MACDENT$FNCITEMS" "MACDENT$FNCITEMS" WHERE
    SQL> select 22
    from DUAL
    where ( to_number(0) <> 0 ) and exists (
    select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(0) ) );
    2 3 4 5 6
    no rows selected
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 883410849
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    Time | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 1 | | 0 (0)| | | | |
    |* 1 | FILTER | | | | | | | | |
    | 2 | FAST DUAL | | 1 | | 2 (0)|00:00:01 | | | |
    | 3 | PX COORDINATOR | | | | | | | | |
    | 4 | PX SEND QC (RANDOM)| :TQ10000 | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | P->S | QC (RAND) |
    | 5 | PX BLOCK ITERATOR | | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | PCWC | |
    |* 6 | TABLE ACCESS FULL| MACDENT$FNCITEMS | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | PCWP | |
    Predicate Information (identified by operation id):
    1 - filter(NULL IS NOT NULL AND EXISTS (SELECT 0 FROM "TABULA"."MACDENT$FNCITEMS" "MACDENT$FNCITEMS" WHERE
    "MACDENT$FNCITEMS"."QIV"=0))
    6 - filter("MACDENT$FNCITEMS"."QIV"=0)
    ANY SUGGESTIONS?
    Thanks,

    912294 wrote:
    Hi,
    I'm running this query from the application:
    select 22
    from DUAL
    where ( to_number(0) <> 0 ) and exists (
    select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(0) ) );
    Why are you using "to_number(0)"? the zero is already seen by oracle as a number.
    The to_number function expects to get a character string as the argument: to_number('0')
    See the difference?
    As you currently have it coded, you are forcing oracle to do an implicit conversion of the number zero to the character string '0' in order to pass it to to_number to convert it back to the number zero.
    And what is the point of "where to_number(0) <> 0"
    When would that EVER be true?
    And it takes a long time because it is checking the second condition.
    Even though the first one is False.
    When running it through sqlplus it takes nothing. and of course no rows returns.
    The 0 in to_number is a bind variable
    it looks like this:
    select :intvar
    from DUAL
    where ( to_number(:QIV$) <> 0 ) and exists ( select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(:QIV$) ) )
    So the query you showed at the top is not the query we are really dealing with. What is the data type of QIV$? At least now we know that comparison to zero is not a fixed value.
    1 - filter predicate: ( IS NOT NULL AND 0<>TO_NUMBER(TO_CHAR(:QIV$)))
    This suggests QIV$ is already a number, else why would you pass it to to_char? And as I said above, if it is already a number, why pass it to to_number? Here you appear to be explicitly doing what I described oracle as implicitly doing in your first query above.
    But in sqlplus the filter predicates is different.
    1 - filter(NULL IS NOT NULL AND EXISTS (SELECT 0 FROM "TABULA"."MACDENT$FNCITEMS" "MACDENT$FNCITEMS" WHERE
    SQL> select 22
    from DUAL
    where ( to_number(0) <> 0 ) and exists (
    select 'X'
    from TABULA.macdent$FNCITEMS
    where ( macdent$FNCITEMS.QIV = to_number(0) ) );
    2 3 4 5 6
    no rows selected
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 883410849
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    Time | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 1 | | 0 (0)| | | | |
    |* 1 | FILTER | | | | | | | | |
    | 2 | FAST DUAL | | 1 | | 2 (0)|00:00:01 | | | |
    | 3 | PX COORDINATOR | | | | | | | | |
    | 4 | PX SEND QC (RANDOM)| :TQ10000 | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | P->S | QC (RAND) |
    | 5 | PX BLOCK ITERATOR | | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | PCWC | |
    |* 6 | TABLE ACCESS FULL| MACDENT$FNCITEMS | 63M| 782M| 2 (0)|00:00:01 | Q1,00 | PCWP | |
    Predicate Information (identified by operation id):
    1 - filter(NULL IS NOT NULL AND EXISTS (SELECT 0 FROM "TABULA"."MACDENT$FNCITEMS" "MACDENT$FNCITEMS" WHERE
    "MACDENT$FNCITEMS"."QIV"=0))
    6 - filter("MACDENT$FNCITEMS"."QIV"=0)
    ANY SUGGESTIONS?
    Thanks,

  • How to avoid Huge scan with case condition in the select statement.

    Hi ,
    I have the below sql and add condition such that c.ROLE = 18 then tibex_fixrestorestateview needs to be queried else it should not query the tibex_fixrestorestateview.
    tibex_fixrestorestateview contains 10 to 20 millions records so to avoid scanning when c.ROLE <> 18
        SELECT c.connectionid, u.participantid, c.port, u.PASSWORD, cg.gatewayid,
               c.ROLE, u.cancelonlogout, NVL (f.tofixsequence, 1) AS tofix,
               NVL (f.fromfixsequence, 1) AS fromfix
          FROM tibex_connectiongroup cg INNER JOIN tibex_connection c
               ON cg.connectiongroupid = c.connectiongroupid
               LEFT JOIN tibex_user u ON c.connectionid = u.userid
               *LEFT JOIN tibex_fixrestorestateview f*
              ON u.useralias = f.useralias AND c.ROLE = 18;Regards
    NM

    Hi;
    I suggest close your issue here as answered than move your issue Forum Home » Database » SQL and PL/SQL which you can get more quick response
    Regard
    Helios

  • Access 2010 - If Then Else Statement to display text within text box upon Check Box True/False condition

    I have a form called myForm. On this form is a check box called myCheckBox. I also have a text box labeled myTextBox. I have assigned a macro, myMacro, to run upon selection/click of myCheckBox. The macro is an If statement which determines if myCheckBox
    is checked or not checked and spits out a value, "Yes" or "No" for example, into the text box.
    I am not able to get text to display into the text box although I am not receiving any errors when I run the macro. This may be a fault in my logic and would like help resolving where the problem lies. I am fairly new to Access so this could be something
    simple.
    My code is as follows:
    If Forms!myForm =  True Then
      Forms!myForm!myTextBox.Value = "Yes!"
    ElseIf Forms!myForm = False Then
      Forms!myForm!myTextBox.Value = "No!"
    Else
      Forms!myForm!myTextBox.Value = " / ERROR / " 
    End if
    Thanks!

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, the issue is more related to coding/programing, you'd better post your question to the MSDN forum for Access
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

  • IF THEN ELSE STATEMENT IN BeX Query designer

    Hi,
    I want to write a query as follows:
    IF <Value a> is available THEN <Value a> ELSE <Value b>
    I have written it as follows:
    (X>0)X+(X<=0)Y
    The problem with this equation is,  in case X = 0(number Zero) then Y is not getting displayed. But In case X =NULL (or no values) then Y displayed. This is leading to inconsistency in final result. Please help in rectifying the formula incase it is incorrect or is it because of some program bug in BeX?
    Regards
    Madhav

    This works for me...dont understand y its not working with u!!
    it is simple:
    (X<>0)X+(X==0)Y
    If X is 0, then  0X + 1Y = Y
    else
    1X + 0Y = X.
    What result you are getting in both cases?
    as you thing,X value is may not be 0 in your case. It may be 0.00004...something like that...Set Decimal Places to 5 or 6 to X.
    Message was edited by:
            Muralidhar C

  • If then Else statement not working under Computation in APEX

    Hi
    Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
    Page:
    *Item Name (Value Required)
    Type
    Static Assignment
    PL/SQL Function Body
    SQL Query (return single value)
    SQL Query (return colon separated value)
    SQL Expression
    PLSQL Expression
    Item Value
    Computation Point
    *Sequence (Value Required)
    Computation Point
    On New Instance (new session)
    Before Header
    After Header
    Before Region(s)
    After Region(s)
    Before Footer
    After Footer
    After Submit
    Source
    *Computation (Value Required)
    BEGIN
    IF :P3_AGING_DAYS <= '0' THEN
    :P3_AGING_BUCKET := 'Within due date';
    elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
    :P3_AGING_BUCKET := 'Within 3 days';
    end if;
    end;

    1efb2968-171d-43f9-9d5d-d38151735ed7 wrote:
    Please update your forum profile with a real handle instead of "1efb2968-171d-43f9-9d5d-d38151735ed7".
    Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
    BEGIN
    IF :P3_AGING_DAYS <= '0' THEN
    :P3_AGING_BUCKET := 'Within due date';
    elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
    :P3_AGING_BUCKET := 'Within 3 days';
    end if;
    end;
    A PL/SQL Function Body computation has to return a value rather than assigning it to an item in the PL/SQL block (APEX turns the block into the body of a function). The item for which the value is to be computed is specified in the computation properties (P3_AGING_BUCKET).
    begin
      return case
               when :p3_aging_days < 1
               then
                 'Within due date'
               when :p3_aging_days between 1 and 3
               then
                 'Within 3 days'
             end;
    end;

  • HT1296 I updated my ipod touch with IOS 6, then downloaded You tube onto my computer then tries to synch it with my ipod. The you tube app icon is present on the computer but doesn't appear on ipod. the app store states that it is installed but it isn't.

    Help! I updated my son's ipod touch with the IOS 6 update. Then i downloaded the new You tube app onto my itunes on the computer. When i synched my ipod the computer showa You Tube on the ipod but it isn't there and i cannot get it reinstalled. please help. This is very frusterating because there is obviously a glitch and i can't fix it. Any suggestions?

    Have you tired using the Spotlight search? Maybe you just can't find it.
    Do you have Restrictions on that would hid the app? Settings>General>Restrictions.

  • Use If then else statement to display concatenated values

    Hi,
    I am trying to create a field which will display 2 different names depending on the status of another field.
    Here is the code I have but it returns no data when I try it:
    <?xdofx:if ReportStatus='Approved' then concatenate(DisplayFirstName, DisplayLastName) else concatenate(InvFirstName, InvLastName) end if?>
    (Also I need to solve how to create a space between the first and last names)
    Any help would be appreciated thanks

    Use the following.
    <?choose:?>
    <?when:ReportStatus='Approved' ?>
    <?DisplayFirstName?> aspace <?DisplayLastName?> or <?concat(DisplayFirstName,' ', DisplayLastName)?>
    <?end when?>
    <?otherwise:?>
    <? InvFirstName?> a space <? InvLastName?>  or <?concat(InvFirstName,' ', InvLastName)?>
    <?end otherwise?>
    <?end choose?>

Maybe you are looking for

  • Windows vista 64 bit and ipod nano

    Hi, we are having problems getting our 3 new ipod nano generation 5 to work on our windows vista computer. Itunes won't recognize them have tried to uninstall itunes but get a message to verify we have sufficient access to that key, or contact suppor

  • You can no longer change the password

    Good day! I have a problem on a Netweaver 2004s BI server. When a user tries to change his password at the logon screen, the error message : "You can no longer change the password" appears. To clarify, user types his current user id and password in t

  • My mac's sound system seems to be having problems.

    I can't seem to adjust it from the keyoard shortcuts usin f10,11 and 12. The only way i can adjust them is by going into the sound part of system preferences.

  • How do i find out how many computers that I have authorized on my Itunes id

    How do i find out how many computers is authorized on my Itunes account.  I know i can have 5 computers, but i need to know where i can go to see how many are authorized.

  • Setting for photo taking on N95

    N95 resumes the photo taking setting to default after I change for a particular photo, i.e., switch off flash, change to close-up mode, etc. Can someone advise me how to save the setting for future use. Thanks!