Using IF or SWITCH functions inside a DAX formula into a tabular model - SSAS 2012

Hi,
in a tabular model I've changed a DAX formula introducing the SWITCH function, but when I deploy the changed formula and open the Excel workbook the slicer connected to the pivot table doesn't highlight the slicer values involved as instead of old formula.
Any suggests to me in order to maintain the right behaviour for the slicers when a formula is re-written using an IF/SWITCH functions, please?
Thanks

I think that is the default behaviour and I can find a few justifications for it too...
For eg, if you have a complex IF condition, the measure will have to be evaluated for each value of the slicer for correctly finding the right values in the slicer to highlight, and that can make it REALLY slow.
Also, sometimes there is no correct values to highlight. For eg, if I have the products in the slicer and have a condition like
=IF(HASONEVALUE(Product[Product]),1)
then which Product should be highlighted? There is no correct value as any one of the Product selected on it's own will display value for the measure. And more than one products selected will display no value. So no matter what you display/highlight on the
slicer, there is no "correct" behaviour. In such a case, it is best left to display/highlight all values.
Cheers,
Jason | www.SqlJason.com
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)

Similar Messages

  • How to use select a vi function inside a loop?

    I am modifying the notifier basics part 2.vi to send a notifier to each of 64 sub-vi's. How can you use the 'select a vi' function inside a loop for 64 iterations to access the individual filenames??
    Attachments:
    Notifier_BASICS_Part_2.vi ‏87 KB

    If all you are trying to do is send notifiers to each of these 64 subVIs, I would suggest not doing it in a loop, but rather just placing the 64 subVIs in your diagram.
    The alternative is of course to use the call by reference node and have an array of VI names. This is a little cleaner on the diagram, but 1) doesn't occur in parallel and 2) is a bit tricky. Additionally, you have to be sure that your array of filenames is correct, and that you NEVER move or rename those VIs. Of course, you could always put them in a directory and create an array by reading the directory contents.
    Either way, good luck, it doesn't sound like fun.

  • Use COUNT or MAX functions inside of a query, and you have no data found

    I'm writing a query with a COUNT and a MAX function.
        SELECT  li.id
                 , MAX(m.display_date)
                , COUNT(*)
         FROM li JOIN m  ON (m.LIID=li.LIID)
        WHERE m.DISPLAY_DATE < SYSDATE - 7
        GROUP BY  li.id;I would like to write a query that returns always a row foe each row in the table li.
    If there are no records with the condition "WHERE m.DISPLAY_DATE < SYSDATE - 7", I would like to have a row with
    - COUNT(*) = 0
    - MAX(m.display_date) = TO_DATE('2010-06-08', 'YYYY-MM-DD'

    user600979 wrote:
    I'm writing a query with a COUNT and a MAX function.
    SELECT  li.id
    , MAX(m.display_date)
    , COUNT(*)
    FROM li JOIN m  ON (m.LIID=li.LIID)
    WHERE m.DISPLAY_DATE < SYSDATE - 7
    GROUP BY  li.id;I would like to write a query that returns always a row foe each row in the table li.
    If there are no records with the condition "WHERE m.DISPLAY_DATE < SYSDATE - 7", I would like to have a row with
    - COUNT(*) = 0
    - MAX(m.display_date) = TO_DATE('2010-06-08', 'YYYY-MM-DD'In that case tell me what do you want to display in the ID column. That is the first column?

  • Call library function inside a conditiona​l disable bug

    i'm trying to call a function in a dll using the call library function inside a conditional disable structure.
    one of the parameters is a pointer to a C structure.
    here is the prototype:
    short in myfunction(short in DevNum, void *pMetrics);
    outside of the conditional disable, LabVIEW allows me to wire the pMetrics parameter to a cluster.
    if i put the function inside the conditional disable, LabVIEW doesn't allow me to wire it.
    as a workaround, i put the cluster inside the conditional disable as well.
    any ideas?

    Simply create a constant of the cluster and and put it outside the disable structure. Wire this constant to all inputs (left side terminal) of the Call Library Node. A Call Library Node (CLN) set to Adapt to Type does need a valid datatype to adapt too. This works from the outside side (right side terminal) of the CLN only if the according indicator is inside the same data structure. In older LabVIEW versions you actually had to always define the left side by wiring a constant or a dummy control to it.
    This has to do with the algorithme that evaluates datatypes along wires. Making that algorithme go backwards (against the natural dataflow) inside one subdiagram without causing circular references or similar is already a challange. Doing that across diagram boundaries (case, disable, loop, etc. structures) is basically impossible without causing the entire edit operation to get very slow.
    Message Edited by rolfk on 10-20-2009 08:28 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • FOX forumla in IP: can I use Planing-functions in a FOX-formula ?

    Hi All,
    I know that there is a possibility to call an ABAP functions via a function modules within a FOX formula,
    but is it also possible to use a standard planning functions in a FOX formula ?
    I have some planing functions created like the copy-function, the delete-function or the repost-function.
    Now I would like to use the standard planing functions within a fox formula.
    If it´s possible, how do I call them within a FOX formula?
    Thanks a lot 

    Hi,
    You would be knowing that any planning function gets the data to operate on, based on the filter using which it is executed - it can give entirely different output in two cases if the filters are different. Thats why it does not mean much to call a planning function from inside another planning function - think about it, the situation will get messy if that was done. As I understand, you probably want to execute some standard functions after some part of your fox code and after that is executed, get back on with the code.
    For such a requirement, you can break your fox into multiple parts and then combine the parts and the std. pl. functions in a planning sequence in the order you need.
    But please also remember that depending on the complexity, many times it is advisable to create one fox (or exit) function rather than a sequence of many functions. Reason being that each function's execution in the sequence will include some overhead due to the planning framework (determining the transaction and reference data, lock server etc), so if you create just one function for the whole operation, this overhead will get significantly reduced.

  • Creating Tabular Models using AMO

    Hi,
       I am trying to setup Tabular Models on SSAS using AMO referring to the materials available at Technet and the Codeplex AMO Tabular Tutorial. I have a few questions/issues
    currently and was hoping I could get some help from here. The tool I am working with currently supports Multidimensional mode via AMO and I am trying to extend most of its features from the Multidimensional model. So, some of the questions might not exactly
    fit into the Tabular model and if so, please do point them out.
    RELATIONSHIPS: While creating relationships among tables,
    would it suffice to create the relationship in the Data Source View Schema (as the tool currently does for the Multidimensional mode) or should we explicitly create relationships under the dimensions that we create to represent the table in Tabular mode? The
    latter is the approach mentioned in the tutorial and I wanted to know if there is any difference between the relationships created using the 2 methods.
    MEASURES: I am trying to create measures using Native
    OLAP Measure objects in the Tabular model. I understand the shortcomings of this type of measures but I would still need to create them for basic aggregation functions like SUMMATION, COUNTS etc… I tried creating the measures using the same Measure Group that
    was created to represent the table and used a ColumnBinding to the Measure’s source-column for the measure object’s source property but I get the following error:
    Binding for VertiPaq measure MEASURE_NAME in measure group MEASURE_GROUP_NAME is invalid because it does not match any property binding of the fact dimension
    TABLE_NAME
    Am I missing anything here? Is there a better way of creating OLAP measures in TABULAR model without using the default Table dimensions that we create?
    HIERARCHIES: I tried creating new Dimensions to hold
    hierarchies for a table but when creating them, I get the error about MISSING ROWNUMBER attribute. Is this attribute mandatory for every dimension that is created?
    To avoid this problem, I used the same dimension that was created to represent the table and tried adding inter-table attribute relationships to it but I get the following exception
    message which I cannot figure out.
    VertiPaq property ‘’ cannot have a name binding.
    In general, can we create separate measure groups and dimensions, apart from the ones we use to represent the table, to store the custom measures and hierarchies? Is this a recommended
    approach? This way, I am trying to keep things in parallel with the Multidimensional model that our tool currently supports but when I create such individual dimensions and measure groups, I get an error on the mismatch between the number of measure groups
    and dimensions in the table.
       Please bear with the long list of questions. I could not find any help online for these and so am posting them all here.
    Thank you.

    RELATIONSHIPS: While creating relationships among tables,
    would it suffice to create the relationship in the Data Source View Schema (as the tool currently does for the Multidimensional mode) or should we explicitly create relationships under the dimensions that we create to represent the table in Tabular mode? The
    latter is the approach mentioned in the tutorial and I wanted to know if there is any difference between the relationships created using the 2 methods.
    No - relationships in the DSV have no impact on the end model. You need to explicitly create relationships between your dimensions and measure groups for them to be picked up as relationships in your tabular model.
    MEASURES: I am trying to create measures using Native OLAP
    Measure objects in the Tabular model. I understand the shortcomings of this type of measures but I would still need to create them for basic aggregation functions like SUMMATION, COUNTS etc… I tried creating the measures using the same Measure Group that was
    created to represent the table and used a ColumnBinding to the Measure’s source-column for the measure object’s source property but I get the following error:
    Binding for VertiPaq measure MEASURE_NAME in measure group MEASURE_GROUP_NAME is invalid because it does not match any property binding of the fact dimension TABLE_NAME
    Am I missing anything here? Is there a better way of creating OLAP measures in TABULAR model without using the default Table dimensions that we create?
    There is no concept of native measures in a Tabular model. You need to create all your measures as "Calculated Measures" in AMO, but using the appropriate DAX expressions instead of MDX.
    HIERARCHIES: I tried creating new Dimensions to hold hierarchies
    for a table but when creating them, I get the error about MISSING ROWNUMBER attribute. Is this attribute mandatory for every dimension that is created?
    To avoid this problem, I used the same dimension that was created to represent the table and tried adding inter-table attribute relationships to it but I get the following exception message
    which I cannot figure out.
    VertiPaq property ‘’ cannot have a name binding.
    Yes, I believe every table needs the hidden RowNumber attribute. The
    TableAddEmptyTable function in the tabular AMO sample on codeplex shows you how to create this.
    In general, can we create separate measure groups and dimensions, apart from the ones we use to represent the table, to store the custom measures and hierarchies? Is this a recommended
    approach? This way, I am trying to keep things in parallel with the Multidimensional model that our tool currently supports but when I create such individual dimensions and measure groups, I get an error on the mismatch between the number of measure groups
    and dimensions in the table.
    No you can't create any extra structures. Tabular projects only supports a subset of AMO. You need to follow the example on codeplex very closely and read all the code comments if you are making changes because it's very easy to break things.
    My suggestion is to create an abstraction layer either using the TabularAMO library from codeplex as it is or creating your own library if you only need a subset of the functionality. This will mean that your core code is not too tightly bound to AMO. The
    reason for this is that I would hope that MS will replace AMO with something better for Tabular models in a coming release and having a clear abstraction layer should make it easier to update to a new API.
    http://darren.gosbell.com - please mark correct answers

  • Processing of a deployed Tabular model inside SSDT

    Hi,
    operating inside SSDT, does it exist a manner to process a tabular model (or a table/partition) already deployed on the SSAS instance?
    I know that it is possible to process only the workspace data.
    Thanks

    Hi Pscorca,
    According to your description, you want to process data for a tabular model which had already been deployed on the SQL Server Analysis Services instance. When authoring your model project, process actions must be initiated manually in SQL Server Data Tools
    (SSDT). After a model has been deployed, process operations can be performed by using SQL Server Management Studio or scheduled by using a script. So we cannot process data for a tabular model which had already been deployed on the SQL Server Analysis Services
    instance.
    If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product.
    Thank you for your understanding.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Using HASONEVALUE and SWITCH dax functions - SSAS 2012 Tabular

    Hi,
    I'm testing the behaviour of a series of Dax formulas created in a my tabular model. In order to detect a "strange" anomaly, I'm analyzing in particular this formula:
    IF( HASONEVALUE( Products[ProductID] ),
    SWITCH(
    VALUES( Products[CategoryID] ),
    "Cat1", <measure_for_Cat1>,
    "Cat2", <measure_for_Cat2>,
    For this example, I've a fact table (e.g. having orders) with a product id and a products table with product id, product descr, category id, etc.
    In the pivot table on Excel, product id can be put as a filter or as a row, but the category id (evaluated in the SWITCH function) is not to show to the end user.
    I'd like to understand if a dax formula so built could give an error: when I put the product id as a row the related measure is calculated rightly, but if I try to filter some values for the product id the measure are not determined rightly respect to the
    filtered product id on row. Perhaps, the VALUES in the SWITCH function has a bad behaviour.
    Any suggests to me, please?
    Thanks

    Hi ,
    SUMMARIZE(<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)
    SUMMARIZE(ResellerSales_USD
    , DateTime[CalendarYear]
    , ProductCategory[ProductCategoryName]
    , "Sales Amount (USD)", SUM(ResellerSales_USD[SalesAmount_USD])
    , "Discount Amount (USD)", SUM(ResellerSales_USD[DiscountAmount])
    so in cube you for calculated column it would be
    =SUMMARIZE(ResellerSales_USD
    , DateTime[CalendarYear]
    , ProductCategory[ProductCategoryName]
    , "Sales Amount (USD)", SUM(ResellerSales_USD[SalesAmount_USD])
    , "Discount Amount (USD)", SUM(ResellerSales_USD[DiscountAmount])
    thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • If we use DML statement in function then that function can be used inside s

    if we use DML statement in function then that function can be used inside select query or any DML query?

    select f from t2;I think you meant to query t1.
    It works if the function is an autonomous transaction:
    create or replace function f return number
    is
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
        update t1 set c=2;
        commit;
        return 1;
    end;
    select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
    An an answer to an interview question though nothing wrong with it.

  • How to use analytical functions inside a mapping

    Hello everybody. Here Isend you a trick that we are using for two years.
    If you want to use a function (for instance :ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...)) inside a mapping you must create an expression with in the INGRP1 the fields you are going to use in the window function and in the OUTGRP1 the function you want. Create an Out -attribute with the expressión and link it to a distinct operator (using a "distinct" you encapsulte the sql and you will be able to use the function inside a filter - in the where clause.). The distinct can eliminate some register (depends on the function). If you validate the expression an error will appear (don't worry about that, the mapping will be ok).
    But there is a limitation, you will not be able tou sum over, min over, max over (it detect that they are aggregator functions). Other limitation: the debugger doesn't run with this kind of functions.
    Please publish this information on "The Warehouse Builder Utility Exchange". Mi email is [email protected] (if you need more information)

    It is possible to add SUM, MIN, MAX functions also to OWB releases prior to Paris - You have to put them in double quotes - write "MIN" "MAX" "SUM" etc. The rest of the rules (adding cut-off operator after the expression - as DISTINCT, or UNION ALL) is analogical to with ROW_NUMBER()
    That means You can create mapping with following functionality:
    SELECT
    sum (salary) over (partition by DEPARTMENT) department_salary,
    salary,
    employee_id,
    employee_name
    FROM employees_salaries
    writing it this way in OWB:
    SELECT
    "SUM" (salary) over (partition by DEPARTMENT) department_salary,
    salary,
    employee_id,
    employee_name
    FROM employees_salaries
    Regards,
    Martin

  • Problem in using aggregate functions inside case statement

    Hi All,
    I am facing problem while using aggregate functions inside case statement.
    CASE WHEN PSTYPE='S' THEN MAX(DECODE(POS.PBS,1,ABS(POS.PPRTQ),0)) ELSE SUM(DECODE(POS.PBS,1,ABS(POS.PPRTQ),0)) END,
    how can I achieve above requirement ? Con anyone help me.
    Thanks and Regards
    DG

    Hi All,
    Below is my query:
            SELECT
            CASE WHEN p_reportid IN ('POS_RV_SN','POS_PB') THEN POS.PACCT
            ELSE POS.PACCT || '-' || DECODE(POS.SYSTEMCODE,'GMI1','1', 'GMI2','2', 'GMI3','4', 'GMI4','3', '0') ||POS.PFIRM|| NVL(POS.POFFIC,'000') END,
            CASE WHEN p_reportid IN ('POS_RV_SN','POS_PB') THEN POS.PACCT||POS.PCUSIP||DECODE(POS.PBS,1,'+',2,'-')
            ELSE POS.PFIRM||POS.POFFIC||POS.PACCT||POS.PCUSIP||DECODE(POS.PBS,1,'+',2,'-') END,POS.SYSTEMCODE,CASE WHEN POS.PSTYPE='S' THEN POS.PSYMBL ELSE POS.PFC END,POS.PEXCH||DECODE(POS.PSUBEX,'<NULL>',''),
            POS.PCURSY,
            CASE WHEN POS.PSBCUS IS NULL THEN SUBSTR(POS.PCTYM,5,2) || SUBSTR(POS.PCTYM,1,4) ELSE POS.PSBCUS || SUBSTR(POS.PCTYM,5,2) || SUBSTR(POS.PCTYM,1,4) END ,
            NVL(POS.PSUBTY,'F') ,POS.PSTRIK,*SUM(DECODE(POS.PBS,1,ABS(POS.PPRTQ),0)) ,SUM(DECODE(POS.PBS,2,ABS(POS.PPRTQ),0))* ,
            POS.PCLOSE,SUM(POS.PMKVAL) ,
            TO_CHAR(CASE WHEN INSTR(POS.PUNDCP,'.') > 0 OR LENGTH(POS.PUNDCP) < 15 THEN POS.PUNDCP ELSE TO_CHAR(TO_NUMBER(POS.PUNDCP) / 100000000) END),
            POS.UBS_ID,POS.BBG_EXCHANGE_CODE,POS.BBG_TICKER ,POS.BBG_YELLOW_KEY,POS.PPCNTY,POS.PMULTF,TO_CHAR(POS.BUSINESS_DATE,'YYYYMMDD'),
            POS.SOURCE_GMI_LIB,
            --DECODE(POS.SYSTEMCODE,'GMI1','euro','GMI2','namr','GMI3','aust','GMI4','asia','POWERBASE','aust','SINACOR','namr',POS.SYSTEMCODE),
            DECODE(p_reportid,'RVPOS_SING','euro','RVPOS_AUSTDOM','aust','RVPOS_AUSTEOD','euro','RVPOS_GLBLAPAC','asia','POS_RV_SN','namr','POS_PB','aust',POS.SYSTEMCODE),
            POS.RIC,
            CASE WHEN PSUBTY = 'S' THEN POS.TYPE ELSE NULL END,
            DECODE(POS.UBS_ID,NULL,POS.PCUSP2,POS.ISIN),POS.UNDERLYING_BBG_TICKER,POS.UNDERLYING_BBG_EXCHANGE,POS.PRODUCT_CLASSIFICATION,
            CASE WHEN PSUBTY = 'S' THEN POS.PSDSC2 ELSE NULL END,
            CASE WHEN PSUBTY = 'S' THEN C.SSDSC3 ELSE NULL END,
            NVL(C.SSECID,POS.PCUSIP),
            NULL,
            POS.PYSTMV,
            POS.PMINIT,
            POS.PEXPDT,
            CASE WHEN POS.PSUBTY='S' THEN  SUBSTR(C.ZDATA2,77,1) ELSE NULL END,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL
            FROM POSITIONS_WRK POS LEFT OUTER JOIN
            (SELECT * FROM CDS_PRODUCTS CP INNER JOIN FUTURE_MASTER FM ON
            (CP.STRXCH=FM.ZEXCH AND CP.SFC=FM.ZFC AND CP.BUSINESS_DATE = FM.BUSINESS_DATE )) C ON POS.PCUSIP = C.SCUSIP
            AND NVL(POS.PCUSP2,'X') = NVL(C.SCUSP2,'X')
            WHERE
            POS.PEXCH NOT IN ('A1','A2','A3','B1','B3','C2','D1','H1','K1','L1','M1','M3','P1','S1')
            AND (POS.PSBCUS IS NOT NULL OR POS.PCTYM IS NOT NULL OR POS.PSTYPE ='S')
            AND POS.BUSINESS_DATE = run_date_char
            GROUP BY
            POS.UBS_ID,POS.SYSTEMCODE,POS.RECIPIENTCODE,POS.BUSINESS_DATE,POS.PACCT,POS.PFIRM,POS.POFFIC,POS.PCUSIP,POS.PBS,CASE WHEN POS.PSTYPE='S' THEN POS.PSYMBL ELSE POS.PFC END,
            POS.PEXCH,POS.PSUBEX,POS.PCURSY,
            CASE WHEN POS.PSBCUS IS NULL THEN SUBSTR(POS.PCTYM,5,2) || SUBSTR(POS.PCTYM,1,4) ELSE POS.PSBCUS || SUBSTR(POS.PCTYM,5,2)  || SUBSTR(POS.PCTYM,1,4) END,
            NVL(POS.PSUBTY,'F') ,POS.PSTRIK,POS.PCLOSE,TO_CHAR(CASE WHEN INSTR(POS.PUNDCP,'.') > 0 OR LENGTH(POS.PUNDCP) < 15 THEN POS.PUNDCP ELSE TO_CHAR(TO_NUMBER(POS.PUNDCP) / 100000000) END),
            POS.BBG_EXCHANGE_CODE,POS.BBG_TICKER,POS.BBG_YELLOW_KEY,POS.PPCNTY,POS.PMULTF,POS.PSUBTY,POS.SOURCE_GMI_LIB,RIC,
            CASE WHEN PSUBTY = 'S' THEN POS.TYPE ELSE NULL END,
            DECODE(POS.UBS_ID,NULL,POS.PCUSP2,POS.ISIN),POS.UNDERLYING_BBG_TICKER,POS.UNDERLYING_BBG_EXCHANGE,POS.PRODUCT_CLASSIFICATION,
            CASE WHEN PSUBTY = 'S' THEN POS.PSDSC2 ELSE NULL END,
            CASE WHEN PSUBTY = 'S' THEN C.SSDSC3 ELSE NULL END,
            NVL(C.SSECID,POS.PCUSIP),
            POS.PYSTMV,
            POS.PMINIT,
            POS.PEXPDT,
            CASE WHEN PSUBTY = 'S'  THEN  SUBSTR(C.ZDATA2,77,1) ELSE NULL END;Now, could you plz help me in replacing the bold text in the query with the requirement.
    Thanks and Rgds
    DG
    Edited by: BluShadow on 16-May-2011 09:39
    added {noformat}{noformat} tags.  Please read: {message:id=9360002} for details on how to post code/data                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I have problems for to use Start function inside a case structure.

    I am doing data acquisition using the Config, Start and Read functions, all them inside a while loop. I want to use Config function only when certain conditions occur, so I put the function inside a case and no problem. But when I put the start function inside the same case, the acquisition is not good. Please view my attachment. My application is client-server type.
    Attachments:
    scope_server(config_start).vi ‏160 KB

    Boxer,
    I checked your example and have several easy but important suggestions for you:
    1.- First, make sure that the first time you initialize the VI, the AI Config and AI Start are executed, because based on the debug I made, your program doesn't do it, and this is very important.
    2.- Add an AI Clear after the acquisition is done, so that you release the resources. This is a good programming technique, and may help you solve your issue.
    3.- Add an Error Cluster, so that you know if an error occurred at some point of the acquisition. This will help you track the issue.
    4.- What do you mean by "the acquisition is not good". What does it happen? What does it do? Do you get an error? <- This is the reason of step 3.
    5.- Finally, if you have doubts
    programming AI, check one of the shipping examples of LV. They can give you a much clearer idea.
    Hope this helps,
    L Aguila
    Applications Engineeer
    National Instruments

  • Using the result of a function, inside a subselect

    Hi!
    I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
    select * from t_node where node_pk in (get_node_parents_pk(22345));
    The function get_node_parents_pk stands in for the following SELECT-statment:
    select node_pk from t_node_child where parent_node_pk = 12345
    The statement above would return something like this: 12435,23423,23453,23452
    These values represent the node_pk value for the parent nodes.
    I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
    Any clue? =)

    I created a collection type in the database:
    CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
    The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (get_node_parents_pk (22345)));
    ORA-22905: cannot access rows from a non-nested table item
    However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
    So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
    Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
    SELECT *
    FROM t_node
    WHERE node_pk IN (get_node_parents_pk (22345));
    Your reply is much appreciated!
    Kind regards
    Robert

  • Use a package function inside a select of the same package

    Hi.
    How can i use a function defined inside a package, with a select used inside that same package ?
    Example
    ... package example
    CREATE OR REPLACE PACKAGE BODY pkg_example
    AS
         FUNCTION sum_two_values(p_val1 NUMBER,p_val2 NUMBER) RETURN NUMBER
         IS
         BEGIN
         RETURN p_val1 + p_val2;
         END sum_two_values;
         FUNCTION use_another_function_example RETURN VARCHAR2
         IS
         v_value NUMBER;
         BEGIN
         SELECT sum_two_values(2,2) INTO v_value FROM dual;
         RETURN 'waaaazzzzupppppp'
         END use_another_function_example;
    END pkg_example;
    This will not work
    -- SELECT sum_two_values(2,2) INTO v_value FROM dual;
    How can i call a function inside a select statement, a function of the same package where the query is being called.
    (i have Oracle 9.2x)
    Cheers.

    are you sure? you are not using package1, you are using pack1
    SQL> CREATE OR REPLACE PACKAGE package1
      2  IS
      3     FUNCTION f1
      4        RETURN NUMBER;
      5 
      6     FUNCTION f2
      7        RETURN NUMBER;
      8  END;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package1
      2  IS
      3     a   NUMBER;
      4 
      5     FUNCTION f1
      6        RETURN NUMBER
      7     IS
      8     BEGIN
      9        RETURN 1;
    10     END;
    11 
    12     FUNCTION f2
    13        RETURN NUMBER
    14     IS
    15     BEGIN
    16        SELECT package1.f1
    17          INTO a
    18          FROM DUAL;
    19 
    20        RETURN a;
    21     END;
    22  END;
    23  /
    Package body created.
    Why not just this
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE PACKAGE BODY package1
      2  IS
      3     a   NUMBER;
      4     FUNCTION f1
      5        RETURN NUMBER
      6     IS
      7     BEGIN
      8        RETURN 1;
      9     END;
    10     FUNCTION f2
    11        RETURN NUMBER
    12     IS
    13     BEGIN
    14        a:= f1;
    15 RETURN a;
    16     END;
    17* END;
    SQL> /
    Package body created.formatted
    Message was edited by:
    devmiral

  • Can I use table function inside Dynamic query ?

    Dear Gurus,
    I have following code
    DECLARE
    TYPE CRITERIA_LIST_TABLE AS TABLE OF VARCHAR2(20);
    OtherNoList CRITERIA_LIST_TABLE; /* CRITERIA_LIST_TABLE is index by table*/
    QUERY_STRING VARCHAR2(4000);
    BEGIN
    OtherNoList := CRITERIA_LIST_TABLE();
    SELECT DISTINCT REGEXP_SUBSTR('1,5,6,4', '[^\,]+',1, LEVEL ) BULK COLLECT INTO OtherNoList
    FROM DUAL
    CONNECT BY LEVEL <= REGEXP_COUNT('1,5,6,4', '\,') + 1 ;
    QUERY_STRING := 'INSERT INTO TAB1 (C1,C2) '||
    'SELECT C1,'||
    'C2 '||
    'FROM TAB1 ,'||
    'TABLE( '||
              'CAST (OtherNoList AS CRITERIA_LIST_TABLE) '||
                   ') OTHRNOS '||
    'WHERE TAB1.C1 = OTHRNOS.COLUMN_VALUE ';
    DBMS_OUTPUT.PUT_LINE('Query String is '||QUERY_STRING);
    EXECUTE IMMEDIATE QUERY_STRING;
    END;
    Can I use Table function inside dynamic query.
    Thanking in advance
    Sanjeev

    Try:
    DECLARE
    TYPE CRITERIA_LIST_TABLE AS TABLE OF VARCHAR2(20);
    OtherNoList CRITERIA_LIST_TABLE; /* CRITERIA_LIST_TABLE is index by table*/
    QUERY_STRING VARCHAR2(4000);
    BEGIN
    OtherNoList := CRITERIA_LIST_TABLE();
    SELECT DISTINCT REGEXP_SUBSTR('1,5,6,4', '[^\,]+',1, LEVEL ) BULK COLLECT INTO OtherNoList
    FROM DUAL
    CONNECT BY LEVEL <= REGEXP_COUNT('1,5,6,4', '\,') + 1 ;
    QUERY_STRING := 'INSERT INTO TAB1 (C1,C2) '||
    'SELECT C1,'||
    'C2 '||
    'FROM TAB1 ,'||
    'TABLE( '||
    'CAST (:OtherNoList AS CRITERIA_LIST_TABLE) '||
    ') OTHRNOS '||
    'WHERE TAB1.C1 = OTHRNOS.COLUMN_VALUE ';
    DBMS_OUTPUT.PUT_LINE('Query String is '||QUERY_STRING);
    EXECUTE IMMEDIATE QUERY_STRING using OtherNoList;
    END;p.s. not tested
    Amiel Davis

Maybe you are looking for

  • 640x480 Display Resolution when installing Tiger... which is NUTS!

    I bought a ViewSonic 22" Pro Series Display about a year ago, and when I went to upgrade to Tiger 10.4.x today, the desktop display windows and icons were SO HUGE that I almost couldn't access the buttons on the installation disc windows... the DVD i

  • Help regarding a new enhancement

    Hi, We got a new requirement stating that we need to have a link in user interface .So that when the manager clicks on that links we should display the users details like firstname,lastname,email for whom he is the manager in a table format. Can some

  • Why is App Store missing?

    I am trying to download Lion on my Mac ... but I cannot access the App Store. There is no icon on my computer, and I can't find it in applications or anywhere on the computer. I have updated the software, as per instructions. What next? I have alread

  • FI Field Status Group

    Hi, I am working on a BDC Program for posting of FI documents. The documents would have one Vendor Line and Multiple G/L line. Now now for different G/L lines there can be different G/L accounts and hence there can be different Field Status Group. My

  • "The TestStand service did not start up promptly"

    I have a LabView Operator Interface startup problem with TS 4.1. If the OI is started immediately after system boot the operator may get apopup error from TestStand: "The TestStand service did not start up promptly" The TestStand Service has a depend