nested case

I would like to write a nested case, possible?
case
case tool='icd 'then drop_trigger
                     else ch_doc_id
end
case tool <> 'icd' then ch_doc_id
                         else drop_trigger
end
end,

Something like this:

SQL> ed
Wrote file afiedt.buf

  1  with t as (select 'xxx' tool,1 first_field,2 second_field from dual
  2  union select 'yyy',3,4 from dual)
  3  SELECT (CASE DECODE(tool,'xxx',tool,'@@@')
  4          WHEN 'xxx'
  5          THEN first_field
  6          WHEN '@@@'
  7          THEN second_field
  8          END) flds
  9* from t
SQL> /

      FLDS
----------
         1
         4

SQL> 

SQL> ed
Wrote file afiedt.buf

  1  with t as (select 'xxx' tool,1 first_field,2 second_field from dual
  2  union select 'yyy',3,4 from dual)
  3  SELECT (CASE tool
  4          WHEN 'xxx'
  5          THEN first_field
  6          ELSE
  7          second_field
  8          END) flds
  9* from t
SQL> /

      FLDS
----------
         1
         4

SQL> 

Published by: AP on November 17, 2010 03:22

Tags: Database

Similar Questions

  • How can I get the nested case statements to work with listagg?

    I have a statement below that does not work as I want it, here is my code:

    Select

    cases where o.personal_label is not null

    then

    listagg (cases where s.subcodevalue like '% MON %')

    then s.subcodevalue |' '|| o.personal_label

    of other s.subcodevalue

    end,': ')

    the Group (order of s.subcodevalue) as subcodevalue

    on the other

    listagg (s.subcodevalue,': ')

    the Group (order of s.subcodevalue) as subcodevalue

    end

    of mtm_styles_new s, order_mtm o

    where INSTR (o.extras, s.code) > 0

    and o.bodyfitting = s.bodyfitting

    and o.division = s.division

    and s.subcodevalue is not null

    and o.ORDER_MTMID = 'somevalue '.

    It should bring the following

    * MY TEST: RPP

    or the following if the first case is not completed:

    * MONDAY: RPP

    I get an error message saying 'missing keyword', but cannot make out where, can someone please help me here?

    The following works fine as long as it is not a nested case statement, but I need to nest the case statement:

    Select listagg (cases where s.subcodevalue like '% MON %')

    then s.subcodevalue |' '|| o.personal_label

    of other s.subcodevalue

    end,': ')

    the Group (order of s.subcodevalue) as subcodevalue

    of mtm_styles_new s, order_mtm o

    where INSTR (o.extras, s.code) > 0

    and o.bodyfitting = s.bodyfitting

    and o.division = s.division

    and s.subcodevalue is not null

    and o.ORDER_MTMID = 'somevalue ';

    Out alias 'subcodevalue as' the case at the end of the case body.

  • Help - nested Case statement

    Hello everyone.  I'm having a hell of a time trying to understand my nested case statement.  It's pretty simple, but I always feel to get this error:

    ORA-00937: not a single group group function
    * 00937. 00000 - 'not a single-group function. "
    Cause:
    Action:

    However, when I try to enter in a "group by" I get this error:

    ORA-00979: not a GROUP BY expression
    * 00979. 00000 - 'not a GROUP BY expression. "
    Cause:
    Action:

    I don't know if there is something wrong with my nested case statement syntax, or miss me something more fundamental. This is my code:
    SELECT AE.EMP_ID,
      CASE
        WHEN EP.PHYSICAL_DATE IS NULL
        THEN
          CASE
            WHEN EC.ORIGINAL_CONTRACT_START < ((SYSDATE) - 365)
            THEN 'NEEDS PHYSICAL'
            WHEN EC.ORIGINAL_CONTRACT_START < ((SYSDATE) - 330)
            THEN 'COMING UP'
            ELSE 'No'
          END
        WHEN MAX(EP.PHYSICAL_DATE) KEEP (DENSE_RANK LAST
        ORDER BY EP.PHYSICAL_DATE) < ((SYSDATE) - 365)
        THEN 'NEEDS PHYSICAL'
        WHEN MAX(EP.PHYSICAL_DATE) KEEP (DENSE_RANK LAST
        ORDER BY EP.PHYSICAL_DATE) < ((SYSDATE) - 330)
        THEN 'COMING UP'
        ELSE 'No'
      END "Needs Physical?"
    FROM AP AE
    LEFT JOIN EMP_PHYSICAL EP
    ON AE.EMP_ID = EP.EMP_ID
    LEFT JOIN POSITION_OFFERED PO
    ON AE.EMP_ID = PO.EMP_ID
    LEFT JOIN EMP_CONTRACT EC
    ON AE.EMP_ID         = EC.EMP_ID
    WHERE PO.ACTUAL_END IS NULL
    AND (EP.PHYSICAL     = 1
    OR EP.PHYSICAL      IS NULL)
    AND :P71_EMP_ID = AE.EMP_ID;
    I appreciate all help. Nice day.

    Aqua

    SELECT AE.EMP_ID,
    CASE
    WHEN EP.PHYSICAL_DATE IS NULL
    THEN
    CASE
    WHEN EC.ORIGINAL_CONTRACT_START < ((SYSDATE) - 365)
    THEN 'NEEDS PHYSICAL'
    WHEN EC.ORIGINAL_CONTRACT_START < ((SYSDATE) - 330)
    THEN 'COMING UP'
    ELSE 'No'
    END
    WHEN MAX(EP.PHYSICAL_DATE) KEEP (DENSE_RANK LAST
    ORDER BY EP.PHYSICAL_DATE) < ((SYSDATE) - 365)
    THEN 'NEEDS PHYSICAL'
    WHEN MAX(EP.PHYSICAL_DATE) KEEP (DENSE_RANK LAST
    ORDER BY EP.PHYSICAL_DATE) < ((SYSDATE) - 330)
    THEN 'COMING UP'
    ELSE 'No'
    END "Needs Physical?"
    FROM AP AE
    LEFT JOIN EMP_PHYSICAL EP
    ON AE.EMP_ID = EP.EMP_ID
    LEFT JOIN POSITION_OFFERED PO
    ON AE.EMP_ID = PO.EMP_ID
    LEFT JOIN EMP_CONTRACT EC
    ON AE.EMP_ID = EC.EMP_ID
    WHERE PO.ACTUAL_END IS NULL
    AND (EP.PHYSICAL = 1
    OR EP.PHYSICAL IS NULL)
    AND :P71_EMP_ID = AE.EMP_ID;
    GROUP BY AE.EMP_ID,EP.PHYSICAL_DATE,EC.ORIGINAL_CONTRACT_START;

    
    

    Hi,

    You need to add Group by clause at the end of the query i have added above.

  • Nested case in the Expression

    Hello

    I need to create a nested case in an expression statement, but am having no luck. Here's what I need to evaluate:

    Case ingroup.field1
    When NOT NULL then
    Case ingroup.field2
    When NULL then 'n/a '.
    Of other ingroup.field2
    end
    of other ingroup.field1
    end

    When I validate and generate and try to run the SQL outside OWB, I get the following error:
    ORA-00936: missing expression.

    Any ideas on what I could do wrong here?

    Thank you
    Paula

    Instead of using the ingroup.field1 CASE... .use

    CASE WHEN ingroup.field1 IS NOT NULL
    THEN
    CASE WHEN...

    It should work.

  • Cannot not alias a nested CASE statement?

    isn't this possible?

    I get an error ora-00905 missing key when I try the CASE expression nested aliasing, but not the outer CASE ("test case").


    everything works fine if I leave aside the "BOLD" below:


    SOME costs,
    CASES where cost > 1100
    Then CASE when required in (10.50) then cost/2
    cost of other
    END "nested box"
    what cost > = 1100 and cost < 1500
    then cost * 1.1
    When the cost is null then 0
    cost of other
    END "test case".
    IN THE course of
    WHERE course_no in (80,20,135,450,230)
    ORDER BY cost;

    Could not see anything in the documentation on this subject, or I forgot

    Hello

    The columns may have assumed names; expressions that are just a part of computing a column cannot have alias.

    If you assign an alias, Oracle does not provide a way to reference it.

    If you need to refer to an expression, make a separate column, perhaps in a subquery.

  • Work with the nested case statement

    Hi, I tried the SQL to the date below max but not a single runtime error

    Select the case sensitive option

    When f.rv = "BITTER" then

    (case

    When (m.SC. = 'A' and str_name = "ST_DT1")

    or (m.SC. = 'B' and str_name = "ST_DT2")

    or (m.SC. = 'C' and str_name = "ST_DT3") then

    Max (m.STDT)

    Where (mc.sc = 'C' and str_name = "ST_DT4")

    or (mc.sc = 'K' and str_name = "ST_DT5") then

    Max (MC. EDDT)

    on the other

    null

    end)

    on the other

    null

    end

    of memo_con mc

    baro_uy b

    end f

    ped pe

    where b.id = mc.id

    and pe.id = mc.mid

    and pe.id1 = 1234

    and b.cd = f.cd

    and f.id = 93;

    Could you please suggest me the correct way on it.

    Thank you

    You need a group of expression OR the only authorized linked should be aggregation function.

    Onw solution could be to put the aggregate function (MAX) education all about box.

    Like this

    SELECT max)

    case

    When f.rv = "BITTER" then

    case

    When (m.SC. = 'A' and str_name = "ST_DT1")

    or (m.SC. = 'B' and str_name = "ST_DT2")

    or (m.SC. = 'C' and str_name = "ST_DT3")

    then m.stdt

    Where (mc.sc = 'C' and str_name = "ST_DT4")

    or (mc.sc = 'K' and str_name = "ST_DT5")

    then mc.eddt

    end

    end) as maxdate

    of memo_con mc

    baro_uy b

    end f

    ped pe

    where b.id = mc.id

    and pe.id = mc.mid

    and pe.id1 = 1234

    and b.cd = f.cd

    and f.id = 93;

  • using nested case statement does not get the right result

    Hello all;

    I have a sample of data similar to below
    create table t3
    ( 
           id varchar2(200),
           qty number(30),
           qty2 number(30)
    ); 
     insert into t3
       (id, qty, qty2)
     values
       ('A', 10, null);
     
      insert into t3
       (id, qty, qty2)
     values
       ('A', 20, null);
       
     insert into t3
       (id, qty, qty2)
     values
       ('B', null, 5);
       
    insert into t3
       (id, qty, qty2)
     values
       ('B', null, 5);
       
     insert into t3
       (id, qty, qty2)
     values
       ('C', null, -5);
       
    insert into t3
       (id, qty, qty2)
     values
       ('C', null, 5);
    
    
     insert into t3
       (id, qty, qty2)
     values
       ('D', -1, -2);
       
    insert into t3
       (id, qty, qty2)
     values
       ('D', 1, 4);
    This is what looks like data
    ID  QTY  QTY2
    A    10
    A    20
    B              5
    B              5
    C             -5
    C              5
    D    1        4
    D   -1       -2
    It is the output that I desired below
    ID    Status 
    A      Fail
    B      Fail
    C      Pass
    D      Fail
    A is a failure because the sum of the 2 has the value zero, where the summation of the qty was used to determine the State and because the sum of the quantity is not equal to zero, then, it is a failure
    D is a failure because even if the sum of the Qty 1 equals zero, we must make use of summation of the qty 2 instead because he is not null to determine the status and the summation of the qty is 2, where a failure
    etc.

    I tried write something but can not make it work
    select case when sum(v.qty) is not null
                and sum(v.qty) = 0 then 'Pass'
                when sum(v.qty) is not null
                and sum(v.qty) != 0 then 'Fail'
           else
             case when sum(v.qty2) is not null
               and sum(v.qty2) = 0 then 'Pass'
               else
                when sum(v.qty2) is not null 
                  and sum(v.qty2) != 0 then 'Fail'
                  end as status
              end as status
    
    
     from t3 v;
    any help is appreciated. Thank you.

    Try this,

    SELECT ID,
           CASE WHEN NVL(SUM (qty2),1) !=0 THEN 'fail'
                WHEN NVL(SUM (qty),0) != 0 THEN 'fail'
                ELSE 'pass'
           END
      FROM t3
    GROUP BY ID
    
    OUTPUT
    -------------
    
    ID RESULT
    -- ------
    A  fail
    B  fail
    C  pass
    D  fail
    Z  fail
    

    G.

  • Nested Case statement

    Hello
    I need help implementation of multiple Case statements in a select statement. I can not it works in a statement.
    SELECT statement
    select distinct 
    allt.fk_jobcode_id as Job_Code, 
    allt.fk_jobcode_descr as Classification,
    sum(allt.number_of_positions) as Number_Allotted,
    sum(number_of_positions) as Sum_Number_Allotted,
         dept.department_name|| ''||nvl2((CASE WHEN div.division_name <> 'N/A'
        THEN div.division_name  
      END),'/'||DIV.DIVISION_NAME||'',null) as Department_Division,
    allt.fund_type as Fund
    from tbl_allotment allt, tbl_department dept, tbl_division div
    where isdeleted <> 'Y'
     and ALLT.FK_DEPARTMENT_ID = dept.department_id
     and ALLT.FK_DIVISION_ID = div.division_id
    group by fk_jobcode_id, fk_jobcode_descr, fund_type, department_name, division_name 
    HAVING (count(fk_jobcode_descr ) = 1)
    order by Classification asc, Department_Division asc
    1st CASE statement combines the Department_Name and Division_Name values, but does not display the Division_Name if the value is "N/a".
         dept.department_name|| ''||nvl2((CASE WHEN div.division_name <> 'N/A'
        THEN div.division_name  
      END),'/'||DIV.DIVISION_NAME||'',null) as Department_Division,
    value: administrator Office/Administration Council
    value: poster of the administrator of the Office/s/o Board in the Office of the Director of the Board

    I need to extend this now using this CASE statement, which displays the text "Public works" If the department_id = 00072.
         (CASE dept.department_id 
         When '00072' then 'Public Works'
         Else dept.Department_Name
         End) as Department_Name, 
    incorrect: road Rehab program/GLP transport program Admin
    Must fill as: work GLP/public transport program Admin
    select distinct 
    allt.fk_jobcode_id as Job_Code, 
    allt.fk_jobcode_descr as Classification,
    sum(allt.number_of_positions) as Number_Allotted,
    sum(number_of_positions) as Sum_Number_Allotted,
         dept.department_name|| ''||nvl2((CASE WHEN div.division_name <> 'N/A'
        THEN div.division_name  
      END),'/'||DIV.DIVISION_NAME||'',null) as Department_Division,
      (CASE dept.department_id 
         When '00072' then 'Public Works'
        ELSE dept.Department_Name|| ''||nvl2((CASE WHEN div.division_name <> 'N/A'
        THEN div.division_name  
           END),'/'||DIV.DIVISION_NAME||'',null)
      END) as Department_Name1,
    allt.fund_type as Fund
    from tbl_allotment allt, tbl_department dept, tbl_division div
    where isdeleted <> 'Y'
     and ALLT.FK_DEPARTMENT_ID = dept.department_id
     and ALLT.FK_DIVISION_ID = div.division_id
    group by fk_jobcode_id, fk_jobcode_descr, fund_type, department_name, division_name, department_id 
    HAVING (count(fk_jobcode_descr ) = 1)
    order by Classification asc, Department_Division asc
    but once I change the select statement I get only value "Public works" for the Department_Division value. Does not meet Division_Name data. Does anyone know how to combine these CASE statements? Thanks for reading this thread also.

    Hello

    I think you want something like this:

    SELECT       ...
    ,       CASE
               WHEN  department_id = '00072'
               THEN  'Public Works'
               ELSE  dept.department_name
           END
           ||
           CASE
               WHEN  div.division_name != 'N/A'
               THEN  '/' || div.division_name
           END          AS department_name1
    ...
    

    Whenever you have a problem, post a small example (CREATE TABLE and only relevant columns, INSERT statements) of all database tables.
    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
    Always tell what version of Oracle you are using.

  • How to create nested in the cases set out in OBIEE 11 g?

    Hi all

    I need to create a formula by using nested when cases statement. The formula must be created is below:

    = If([AWRV]<0;) "< 0."
    If ([AWRV] = 0; « 0 » ;
    If ([AWRV] < = 15;) ' > 0 and < = 15;
    If ([AWRV] < = 25;) "15 > and < = 25;
    If ([AWRV] < = 50;) "25 > and < = 50;
    If ([AWRV] < = 75;) "50 > and < = 75;
    If ([AWRV] < = 100;) "75 > and < = 100;
    If ([AWRV] < = 200;) ' > 100 and < = 200;
    If ([AWRV] < = 500;) "200 > and < = 500;
    If ([AWRV] < = 1000;) "> 500 and < = 1000;
    If ([AWRV] < = 5000;) "> 1000 and < = 5000;
    If ([AWRV] < = 10000;) ' > 5000 and < = 10000; '> 10000")))

    How to recreate using Nested case when? I tried many ways, but it displays syntax error in obiee11g. This is very important. Can someone shed light on this question pls?

    Thanks in advance,
    Stephanie

    Honey26 wrote:
    Hi all

    I need to create a formula by using nested when cases statement. The formula must be created is below:

    = If ([AWRV]<0;><>
    If ([AWRV] = 0; « 0 » ;
    If ([AWRV]<=15; "="">0 and)<>
    If ([AWRV]<=25; "="">15 and)<>
    If ([AWRV]<=50; "="">25 and)<>
    If ([AWRV]<=75; "="">50 and)<>
    If ([AWRV]<=100; "="">75 and)<>
    If ([AWRV]<=200; "="">100 and)<>
    If ([AWRV]<=500; "="">200 and)<>
    If ([AWRV]<=1000; "="">500 and)<>
    If ([AWRV]<=5000; "="">1000 and)<>
    If([AWRV]<=10000; "="">5000 and <=10000"; "="">10000")))

    How to recreate using Nested case when? I tried many ways, but it displays syntax error in obiee11g. This is very important. Can someone shed light on this question pls?

    Thanks in advance,
    Stephanie

    Try it below:

    BOX WHEN 'fact - open Chargeback '. "" Void Chbk Amt. "< 0="" then="" '=""><>
    WHEN 'fact - open Chargeback '. "" Sub Chbk Amt "= 0 THEN '0'
    WHEN 'fact - open Chargeback '. "" Void Chbk Amt "BETWEEN 0 AND 15 and THEN ' > 0 AND<>
    ........
    ........
    .........
    END

    I hope this helps.

  • Can you have multiple nested DAQmx writing VI?

    Hello everyone. I'm pretty new to Labview and am trying to find the best way to manage several instructions 'if' using a table of clusters and outputing to the various pins on a data acquisition module. Going to work to have a dozen DAQmx live write in the nested case statements, or will it cause errors?

    The goal is to take the entries by the out of control and front panel based on schedules and user input values. Any suggestion would be appreciated.

    I thank very you much in advance!

    James

    Of course, you can have several writing VI DAQmx.

    Here is a tip that will save programming time you:

    The Index Array feature is re-sizable!  You don't need to break a wire table and 4 tables to Index and thread of the constants for each of them to get the individual items.  Just drop a, and then drag the bottom of the knot to the bottom until you get 4 outputs.  By default, they start at 0 and increment by 1 when you get off.  You will get the elements 0, 1, 2, and 3 without having to associate the constants to the index entry.

    I also recommend that, instead to use local variables, you keep the table of boolean in a thread that runs through all cases in a shift register.  Just replace the item array for any element of the array you are editing in a particular case.

    I have also modeled the code, you have no need for dozens of instructions box nested.  For example, you have one ON and OFF cases in one of the nests.  I'm assuming that the only difference is that you are wiring is real or fake.  Wiring just the Boolean value.  Various other code is duplicated between each case.  The same for the upper levels of the nest.  If you write to the acquisition of data in all cases, who move outside the structure of the case and just control what Boolean values to change the Interior structures of the case.

  • Syntax of the case statement / WHEN

    The table I use a depreciation per fiscal year and the fiscal period.  I try to have the amount of depreciation to go to 2 different columns based on the fiscal year and the fiscal year.  I'm doing it with a nested case statement. I know that is not correct, because I get the message ORA-00905.  I'm relatively new to sql and it is contribtuing to my problem as well.  Here is the code I have and suggestions / corrections would be appreciated.  Thanks for the help...

    SELECT

    lao PDR. DEPTID as DEPTID,

    lao PDR. ASSET_ID as ASSET_NO,

    PA. Descr as DESCRIPTION,

    lao PDR. ACCOUNT_AD as AD_ACCT,

    PDL. DE_ACCT, to take into ACCOUNT

    lao PDR. ADEATH as AMT_DEPR,

    PDL. JOURNAL_ID as JRNL_ID,

    PDL. JOURNAL_DATE as JRNL_DT,

    lao PDR. FISCAL_YEAR as FY,

    lao PDR. ACCOUNTING_PERIOD AP,

    CASE

    WHEN RDP. FISCAL_YEAR = 2014 THEN

    WHEN RDP. PERIOD ACCOUNTANT = 11 THEN pdr. DEPR

    END AS CURR_MONTH,

    CASE

    WHEN RDP. FISCAL_YEAR <>2014

    WHEN RDP. ACCOUNTING PERIOD <>11 THEN pdr. DEPR

    END AS PRIOR_MONTH

    OF PS_DEPR_RPT pdr

    INNER JOIN PS_DIST_LN pdl

    THE pdl. BOOK = pdr. BOOK

    AND pdl. BUSINESS_UNIT = pdr. BUSINESS_UNIT

    AND pdl. FISCAL_YEAR = pdr. FISCAL_YEAR

    AND pdl. ACCOUNTING_PERIOD = pdr. ACCOUNTING_PERIOD

    AND pdl. ASSET_ID = pdr. ASSET_ID

    AND pdl. CF_SEQNO = pdr. CF_SEQNO

    INNER JOIN PS_ASSET PA

    WE pa. ASSET_ID = pdl. ASSET_ID

    AND pa. BUSINESS_UNIT = pdl. BUSINESS_UNIT

    WHERE

    lao PDR. BUSINESS_UNIT = "A0465.

    AND pdr. BOOK = 'RUN '.

    AND ((pdr. FISCAL_YEAR = 2014 AND pdr. ACCOUNTING_PERIOD = 11) OR (pdr. FISCAL_YEAR = 2014 AND pdr. ACCOUNTING_PERIOD = 10))

    Hello

    2713822 wrote:

    Thank you... I appreciate the information you provide when you answer these questions.  I always try to get the amount (from the same column) for 2 rows in different columns.  I tried the LAST_VALUE and LAG but it took a long time for the queries to run, I'm looking for another way to do the same.  I'm only using SQL to retrieve data.  I don't have the ability to create or insert.

    I looked the information above and the CASE statement to look like this:

    CASE

    WHEN RDP. FISCAL_YEAR = 2014

    AND pdr. ACCOUNTING_PERIOD = 11

    THEN the RDP. ADEATH AS CURR_MONTH

    ON THE OTHER

    lao PDR. ADEATH AS MONTHS PREVIOUS

    END

    But I'm now getting an "ORA-00905: lack of keyword" message.

    What I'm trying to do is to draw 2 lines 1 to 2014 / 11 and another for 2014 / 10.  The amount for the period 2014 / 11 should go in the current column and the amount for the period 2014 / 10 should go in the previous column.

    Before current assets management

    01 AB01 50.01 50.03

    ....

    If you want to give an alias for a column, then you can say "AS nome_alias" after that tell you what that is in this column.

    'AS nome_alias' applies to the entire column.  Cannot use 'alias_name' in the middle of an expression, for example, in the middle of a CASE expression, before the END keyword.

    If you want to have 2 separate output columns, curr_month and prior_month to your output, you must then 2 separate columns in your SELECT clause.  for example:

    SELECT pdr.branch

    pdr.asset

    CASE

    WHEN pdr.fiscal_year = 2014

    AND pdr.accounting_period = 11

    THEN pdr.depr

    END AS curr_month

    CASE

    WHEN...

    THEN...

    END AS prior_month

    PDR

    ;

    If post you some sample data (CREATE TABLE and INSERT statements), the results and explanations, I could show you how to complete the... sections.

    To find out what version of Oracle you have, use

    SELECT *.

    SINCE the release of v$.

    The output can be messy, like this:

    BANNER

    -------------------------------------------------------------------

    CON_ID

    ----------

    12 c Oracle database Release 12.1.0.1.0 - 64 bit Production

    0

    PL/SQL Release 12.1.0.1.0 - Production

    0

    CORE Production 12.1.0.1.0

    0

    AMT for 64-bit Windows: Version 12.1.0.1.0 - Production

    0

    NLSRTL Version 12.1.0.1.0 - Production

    0

    The important thing is the number 5 parts on the first line; 12.1.0.1.0 in the example above.

  • Easiest way to do this calculation

    If (phase > 180.0F) phase phase = - 360.0F;
    If (phase< -180.0f)="" phase="">
    Phase = phase;

    I keep ending up with a nested case or case structures or serialized structure selects trying to do the math above. Is there a way I can calculate phase in a more concise State?

    To wrap the phase I would add 180, divide by 360 with Q & R, subtract 180 from the rest.

  • Block of sous-schemas to run in parallel

    I'm still new to LabVIEW, if this question is very probably stupid. But I am a little confused by the basics.

    We have a hypothetical test facility. To begin a measurement of what I need:

    1. turn on a couple of power supplies;

    (2 light up a cold room and set the temperature);

    3. While the temperature is defined but strictly after turning on the power supplies I need to do some upgrading/calibration with a couple of generators and a couple of power meters, and I want orders for such equipment must be sent at the same time.

    Well, LabVIEW is good in there, there are many structures I use to run this sequence: power meters installation... then other equipment orders. I can use the sequence of dish. Can I use nested case structures. But my question is: is there some way to just combine some sous-schemas to make them run together?

    To be more precise: I like the "place structure" for his appearance and behavior, but the description in the help leaves confused me a bit, if it's a good fit. Maybe there is a structure better?

    There are some ways more enjoyable to do things become more complicated, but essentially, this is what it looks like.  You can group certain Interior set VI a structure like below to ensure that they are made together.

  • Evaluate several conditions.

    Hello

    I have three sets of routine developed in LabVIEW. I need to run these blocks when certain condition is met, for example,

    If condition 1 is true

    run block 1

    Otherwise, if condition 2 is true

    run block 2

    Another condition 3 is true

    run block 3

    Inputs and outputs are similar in each block. I was hoping to use the state machine architecture but still don't no idea how to do it.

    Kind regards.

    Your problem may be treated with a triply nested case structure.  Evaluate the Condition 1.  The real is "Execute Block 1".  The case of wrong is another matter structure, evaluate Condition 2, True = Execute Block 2, False = another structure of matter, assess the Condition 3, Execute Block 3 = True, False = do nothing.

    If you want to do this in a Machine States, you can proceed as follows: set the following States - 1 evaluate, run 1, review 2, run 2, released 3, run 3.  The State 1 assess don't 'value 1' and if it is true, call State run 1, otherwise it calls State evaluate 2.  You fill in the rest.  Note that you should probably have another State, 'Continue', all the States enforcement (and the wrong case to assess 3) call when they are made, so you don't "stuck".  On the other hand, if the state machine is a Subvi, you could just output (which is another "Pseudostate").

    Bob Schor

  • Convert multiple lines in a row

    Hello

    DB version: 10.2.0.3

    It's the entry

    NAMETotalFree
    ITEM115050
    ITEM2200175

    Expected result:

    Please tell how to get the result in format (SQL using case or nested case) below

    (XXX_utilized columns is on Total - free)

    ITEM1_TOTALITEM1_UtilizedITEM1_FreeITEM2_TOTALITEM2_UtilizedITEM2_Free
    1501005020025175

    Kind regards

    Veera

    with

    the entry like

    ("ITEM1" select name, 150 total, 100 50 used, free of all the double union)

    Select 'ITEM2', 200, 25, 175 double

    )

    SELECT max (case name when total ' ITEM1' then end) item1_total,.

    Max (case name when 'ITEM1' then used end) item1_utilized,.

    Max (case name when free ' ITEM1' then end) item1_free,.

    Max (case name when total ' ITEM2' then end) item2_total,.

    Max (case name when 'ITEM2' then used end) item2_utilized,.

    Max (case name when free ' ITEM2' then end) item2_free

    Since the entry

    ITEM1_TOTAL ITEM1_UTILIZED ITEM1_FREE ITEM2_TOTAL ITEM2_UTILIZED ITEM2_FREE
    150 100 50 200 25 175

    Concerning

    Etbin

Maybe you are looking for