Check Column Type in Calculation View

Hi All,
Before coming to actual problem, let me tell you a little background about the scenario.
Tables are replicated using SLT from a Java based system (SAP MII) to HANA. The table (say TABLE_1) contains a column of type DATE.
SLT be default converts the DATE type to NVARCHAR while replicating.Hence in HANA the column type is NVARCHAR.
Now, in HANA I am converting this column to SAP_DATE format (YYYYMMDD) by using the formula
leftstr(replace("COLUMN_NAME",'-',''),8)
Problem:
The MII (The source system) can also be on HANA. So there are 2 scenario possible.
MII is using some other DB and it is connected to HANA using SLT.
MII is itself is on HANA and no SLT is required.
In scenario 2, since there are no SLT, the column type is DATE in HANA. Therefor the expression leftstr(replace("COLUMN_NAME",'-',''),8) gets failed.
We need to check the data type of column and then change the expression dynamically. For example
If (COLUMN-DATA-TYPE = DATE)
convert to string and the apply the expression leftstr(replace("COLUMN_NAME",'-',''),8)
Else If (COLUMN-DATA-TYPE = NVARCHAR)
apply the expression leftstr(replace("COLUMN_NAME",'-',''),8)
There are system tables/views which can be used to check column data type. But all there are Row-based. We can not use row-based table in calculation view.
Also if we use them some additional privileges will be required for all end-users who need to check output of the views.
Awaiting suggestion/ideas. Thanks.
Regards,
Raja

Hi Raja,
TO_DATS is not available as an expression for graphical calc view.
It is a SQL function.
Question is: what do you need the legacy format for?
Why not use the date data type?
The problem with using the non-date data types to handle date information is that the database cannot know that it is a date column.
Validity checks don't work.
'20141301' is completely fine with the database if it is stored as string - but not as a date.
Cardinality estimations will be off.
How many distinct values can be expected between '20140101' and  '20140201' ?
The date data type "knows" there are only 30 further values possible.
The string representation is open for at least a hundred values - if you just stick to the numeric digits.
Also, when you use this column in your graphical calc view, the frontend UI won't know that it is supposed to be  date column.
No fancy date picker widget will pop up.
Finally, this is slowing down your model.
The conversions need to be done over and over - what for?
All in all, yes, I do see some problems with this approach...
So, you really should consider to perform the conversion before you store the data.
Details on how to configure SLT can be found in, you guessed it, the documentation!
- Lars

Similar Messages

  • How to provide dynamic labels for calculated columns in HANA calc views

    Hi all,
    we have the requirement to provide dynamic labels for some calculated columns in our calculation view - how to do that?
    Thanks and kind regards,
    Alexander

    Calculated Columns can only generate a value from fields of the current item. And only some types of fields (for example, it can't use a lookup column).
    Consider using a workflow to accomplish your goal.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Underlying SQL or SQL Script for Calculated Views Create Graphically

    Hello,
    Is it possible to view the SQL or SQL script generated for calculated views that are created graphically?

    Hi Mike,
    For your calculation view you will find the corresponding column view created in schema '_SYS_BIC'-->Column Tables->
    <packagename>/<Calculation view> --> Open Definition of this and check the 'create statement'.
    Note: This is a information modeler generated SQL script which will show the generated Calculation Scenario and the respective Column View.
    Regards, Rahul
    Seems the answer was already given by Murali while I typed
    Edited by: Rahul Pant on Mar 2, 2012 5:22 AM

  • Input parameter of Analytic view in Calculation View

    Hello Folks,
    I have created an analytic view with some input parameters and using this view in a calculation view.
    when i am checking Data Preview of Calculation view , it is not asking for any input parameter and returning blank values.
    Could you please let me know the where i went wrong.
    Thanks.

    Hello Ravindra,
    Here is scenario :
    AV :   AV_1 w/o parameters
    AV :  AV_2  w/  required parameters
    when i join the both them into CV_1 , I am unable to see input parameter mapping.
    Could you tell me where it is located.

  • Invalid column Index error - While consuming Calculation view via Native SQL

    Hi Experts,
    I am trying to consume a Calculation view (sql script one) , which has input parameters, via Native SQL in a ABAP program .
    Code snippet for the same would be as follows , Upon execution, it throws an error "Invalid Column Index (8) error " . Can anyone help what could be the issue here ?
    Thanks in Advance,
    Suma
    REPORT ZTEST_HANA2.
    *Report to consume Calculation view (script based) from ABAP
    PARAMETERS: ip_docnr type BELNR_D,
                ip_gjahr type GJAHR,
                ip_bukrs type BUKRS,
                ip_blgr type FAGL_RLDNR.
       DATA: LO_SQL_STMT TYPE REF TO CL_SQL_STATEMENT,
              LO_CONN     TYPE REF TO CL_SQL_CONNECTION,
              LO_RESULT   TYPE REF TO CL_SQL_RESULT_SET,
              LV_SQL      TYPE STRING,
              LR_DATA     TYPE REF TO DATA.
        DATA: LX_SQL_EXC           TYPE REF TO CX_SQL_EXCEPTION,
              LT_SEPMAPPS_CLSDINV  TYPE TABLE OF SEPMAPPS_CLSDINV,
              LV_TEXT              TYPE STRING.
        TRY.
    lv_sql = |SELECT * FROM "_SYS_BIC"."DEMO-ABAP/CA_GET_FI_DATA" | &&
                     |WITH PARAMETERS ('placeholder'= ('$$p_DOCNR$$','{ ip_docnr }'),| &&
                      |'placeholder'=('$$p_GJAHR$$','{ ip_gjahr }')| &&
                      |,'placeholder'= ('$$S_BUKRS$$','{ ip_bukrs }')| &&
                      |,'placeholder'= ('$$p_base_ledger$$','{ ip_blgr }') )| .
             LO_CONN = CL_SQL_CONNECTION=>GET_CONNECTION( ).
             "Create an SQL statement to be executed via the connection
              LO_SQL_STMT = LO_CONN->CREATE_STATEMENT( ).
             "Execute the native SQL query
             LO_RESULT = LO_SQL_STMT->EXECUTE_QUERY( LV_SQL ).
             "Read the result into the internal table lt_sepmapps_clsdinv
             GET REFERENCE OF LT_SEPMAPPS_CLSDINV INTO LR_DATA.
             LO_RESULT->SET_PARAM_TABLE( LR_DATA ).
             LO_RESULT->NEXT_PACKAGE( ).
             LO_RESULT->CLOSE( ).
             LO_CONN->CLOSE( ).
        CATCH CX_SQL_EXCEPTION INTO LX_SQL_EXC.
             LV_TEXT = LX_SQL_EXC->GET_TEXT( ).
             MESSAGE LV_TEXT TYPE 'E'.
        ENDTRY.

    Hi Suma,
    Post the SQL you success run directly on Studio together with error message (even if is the Invalid column index error).
    Check there if the parameters case is working properly... Is it really this confusing options:
    p_GJAHR
    S_BUKRS
    p_base_ledger
    Why not all lower or all upper? Anyhow you must test and find which option works according your modeling
    Regards, Fernando Da Rós

  • BSP: How to create check box in a column of a Table View

    Hi All,
    I have a table view in Web IC scenario. my requirement is to display check box in one of the column of the table view.. so that i can select multiple lines from the table and do some calculations!.
    Anybody have any hint/clue
    Thanks in advance,
    sudeep v d.

    Hi,
    This can be achieved by using a Table iterator.
    Please check the standard examples for this.
    Thanks,
    Rashmi.

  • Error in activating Sqlscript Calculation view - Data type mismatch

    Hi All,
    I am trying to create a Calculation view using sql script. When I try to activate the calculation view I get the below error., Could you please help.
    Error
    Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: transaction rolled back by an internal error: column store error: [34011] failed to save calculation scenario : The following errors occured: Inconsistent calculation model (34011)nDetails (Errors):n- CalculationNode (_ELECTION_ANALYTICAL_VIEW) -> attributes -> attribute (VOTE):
    Datatype int of VOTE does not match to datatype fixed18.0(9) in datasource.
    nnnSet Schema DDL statement: set schema "_SYS_BIC"nType DDL: create type "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc/tabletype/VAR_OUT" as table ("VOTE" INTEGER, "NAME_1" VARCHAR(250), "NAME_4" VARCHAR(250))nProcedure DDL: create procedure "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc" ( OUT var_out "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as  n /********* Begin Procedure Script ************/ n BEGIN n n election_analytical_view = CE_OLAP_VIEW("_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_RESULTS_ANA",[VOTE,NAME,NAME_1,NAME_3,NAME_4]);n n var_out = CE_PROJECTION(:election_analytical_view,[VOTE,NAME_1,NAME_4]);nnnnEND /********* End Procedure Script ************/n
    SQL Script
    /********* Begin Procedure Script ************/
    BEGIN
    election_analytical_view = CE_OLAP_VIEW("_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_RESULTS_ANA",[VOTE,NAME,NAME_1,NAME_3,NAME_4]);
    var_out = CE_PROJECTION(:election_analytical_view,[VOTE,NAME_1,NAME_4]);
    END /********* End Procedure Script ************/

    Hi Logesh,
    You have to use at least one aggregation while using CE_OLAP_VIEW. You can not use the same with out aggregation of at least on of the available measures .
    page 96 of SQL Script reference says
    Note you must have at least one <aggregation_exp> in the attributes.
    where
    <aggregate_exp> ::= <aggregate_func>(<aggregate_column> [AS <column_alias>])
    Specifies the required aggregation expression for the key figure.
    <aggregate_func> ::= COUNT | SUM | MIN | MAX
    Specifies the aggregation function to use. Supported aggregation functions are:
    ●count("column")
    ●sum("column")
    ●min("column")
    ●max("column")
    Sreehari

  • Oracle Views with Column type as CLOB

    I have a table which has a column of type CLOB. I am trying to creating a view which has all the columns of that table.
    I get
    Warning: View created with compilation errors.
    SQL> show errors;
    No errors
    Can any one help me how to create a view on a table wihich has a CLOB/BLOB column types. Also how to select the clob data from the view
    sree

    Are you the owner of the view you created?
    Check out the documentation for the SHOW command.
    If you omit schema, SHOW ERRORS assumes the object is located in your current schema.

  • Why calculated column never display on "View - Total" selection

    In SP 2010 Foundation list, I have a calculated column called "COMP TOTAL".
    But why calculated column never display on "View -> Total" selection? In this case any work around for me to display out summation of a calculated field?

    check this
    http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
    https://www.nothingbutsharepoint.com/sites/eusp/pages/sharepoint-displayinig-calculated-column-sums-in-a-view-screencast.aspx

  • How to calculate the total of a calculated column in a list view at the end of the view?

    I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
    the price and quantity but not with the total column. how do I do this?

    You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
    http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
    http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
    Cheers,

  • Column Value change in BO report vs HANA calculation view

    Hi,
    We are having BO  reports on  Standard hana views.
    We have some columns  in calculation view as below in Hana studio
    Column Name     Column Purpose
    1.Cost Center---(Gives cost center number)
    2.Cost center Name--(Gives description of cost center )
    3.Cost Element-which --(Gives cost center number)
    4.Cost Element Name-(Gives description of cost center)
    when we preview the data with these coulumns in hana studio there are giving the result as specified above.
    But if I run the report in BO using the above 4 columns ,I could see only descriptions for all the four columns as below
    1.Cost Center---(Gives description of cost center)
    2.Cost center Name--(Gives description of cost center )
    3.Cost Element-which --(Gives description of cost center)
    4.Cost Element Name-(Gives description of cost center)
    As per our requirement we should get numbers for cost center and cost element.
    I have observed in semantics that cost center and cost element have label columns mapped to them as below
    cost center has labelcolumn as costcenter name
    cost element has labelcolumn
    Please see the attached file . Is this happend because of the labelcolumn mapping
    we want the cost center and cost element to be displayed as numbers only.  Please suggest me on this.
    Thanku

    Hi Chandra,
    TEXT is coming because you have defined as "Label Column" . In HANA, Data preview the column names will only come but not "Descriptions".
    What is your reporting tool?  If it is AO, have a look on the below blog:
    Using Text Joins to enrich Attributes with "Texts" in SAP HANA with SAP BO Analysis Office
    Regards,
    Krishna Tangudu

  • How to retrieve view column type?

    I know how to retrieve column names and comments from
    table all_col_comments.But I don't know retrieving view column type.If somebody know please help.

    ALL_TAB_COLUMNS
    ALL_TAB_COLUMNS describes the columns of the tables, views, and clusters accessible to the current user. To gather statistics for this view, use the SQL ANALYZE statement or the DBMS_STATS package.
    Related Views
    DBA_TAB_COLUMNS describes the columns of all tables, views, and clusters in the database.
    USER_TAB_COLUMNS describes the columns of the tables, views, and clusters owned by the current user. This view does not display the OWNER column.
    Column Datatype NULL Description
    OWNER
    VARCHAR2(30)
    NOT NULL
    Owner of the table, view, or cluster
    TABLE_NAME
    VARCHAR2(30)
    NOT NULL
    Name of the table, view, or cluster
    COLUMN_NAME
    VARCHAR2(30)
    NOT NULL
    Column name
    DATA_TYPE
    VARCHAR2(30)
    Datatype of the column
    DATA_TYPE_MOD
    VARCHAR2(3)
    Datatype modifier of the column
    DATA_TYPE_OWNER
    VARCHAR2(30)
    Owner of the datatype of the column
    DATA_LENGTH
    NUMBER
    NOT NULL
    Length of the column in bytes
    DATA_PRECISION
    NUMBER
    Decimal precision for NUMBER datatype; binary precision for FLOAT datatype, null for all other datatypes
    DATA_SCALE
    NUMBER
    Digits to right of decimal point in a number
    NULLABLE
    VARCHAR2(1)
    Specifies whether a column allows NULLs. Value is N if there is a NOT NULL constraint on the column or if the column is part of a PRIMARY KEY.
    COLUMN_ID
    NUMBER
    NOT NULL
    Sequence number of the column as created
    DEFAULT_LENGTH
    NUMBER
    Length of default value for the column
    DATA_DEFAULT
    LONG
    Default value for the column
    NUM_DISTINCT
    NUMBER
    These columns remain for backward compatibility with Oracle7. This information is now in the TAB_COL_STATISTICS views. This view now picks up these values from HIST_HEAD$ rather than COL$.
    LOW_VALUE
    RAW(32)
    HIGH_VALUE
    RAW(32)
    DENSITY
    NUMBER
    NUM_NULLS
    NUMBER
    Number of nulls in the column
    NUM_BUCKETS
    NUMBER
    The number of buckets in histogram for the column
    Note: The number of buckets in a histogram is specified in the SIZE parameter of the SQL statement ANALYZE. However, Oracle does not create a histogram with more buckets than the number of rows in the sample. Also, if the sample contains any values that are very repetitious, Oracle creates the specified number of buckets, but the value indicated by this column may be smaller because of an internal compression algorithm.
    LAST_ANALYZED
    DATE
    The date on which this column was most recently analyzed
    SAMPLE_SIZE
    The sample size used in analyzing this column
    CHARACTER_SET_NAME
    VARCHAR2(44)
    The name of the character set: CHAR_CS or NCHAR_CS
    CHAR_COL_DECL_LENGTH
    NUMBER
    The length
    GLOBAL_STATS
    VARCHAR2(3)
    For partitioned tables, indicates whether column statistics were collected for the table as a whole (YES) or were estimated from statistics on underlying partitions and subpartitions (NO).
    USER_STATS
    VARCHAR2(3)
    Were the statistics entered directly by the user?
    AVG_COL_LEN
    NUMBER
    Average length of the column (in bytes)
    CHAR_LENGTH
    NUMBER
    Displays the length of the column in characters. This value only applies to the following datatypes:
    CHAR
    VARCHAR2
    NCHAR
    NVARCHAR
    CHAR_USED
    VARCHAR2(1)
    B | C. B indicates that the column uses BYTE length semantics. C indicates that the column uses CHAR length semantics. NULL indicates the datatype is not any of the following:
    CHAR
    VARCHAR2
    NCHAR
    NVARCHAR2
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2143.htm#1302694
    Joel P�rez

  • Check flat file column list and column types

    Hi guys!
    Is there any "easy" way to check if the source flat file column names and column types correspond to target datastore column name and types ?
    Regards,
    PsmakR

    Hi,
    There is a way that I already used some time to validate if the data is the one expected into target.
    Conditions:
    1) The file source must have all columns as "String"
    2) All mapping for the analysed columns must be done at "staging area"
    How I do it: (oracle way)
    1) create a database function (by ODI procedure) like:
    create or replace function F$_DATATYPE (pData in varchar2, pDatatype in varchar2, pFormat in varchar2)
    return varchar2 as
    vDate date;
    vNumber number;
    BEGIN
    if pDatatype = 'D' then /* Date */
    vDate := to_date(pData, pFormat);
    elsif pDatatype = 'N' then /* Number */
    if pFormat is null then
    vNumber := to_number(pData);
    else
    vNumber := to_number(pData, pFormat);
    end if;
    end if;
    return 'OK';
    EXCEPTION
    When OTHERS then
    return 'KO';
    end F$_DATATYPE ;
    3) Now you can create a constraint to each source column that you wish to validate data like:
    'OK' = F$_DATATYPE(my_source_column, 'D', 'ddmmyyyy hh24:mi:ss' ) /* to a date column as example */
    4) drag and drop the source datasource (table from model) into package and a E$ table with all errors will be created.
    Does it help you?

  • View does not show column type

    I have two views containing a column, which is defined exactly in the same way. One view shows the column type as VARCHAR2 (200 CHAR) and the other does not show anything as the type.
    Here is the screen shot:
    http://public.ceving.de/2012050900/postaladdress.png
    First question: why is there a difference?
    Second question: why is the type VARCHAR2 although the modeler does not know VARCHAR2 but only VARCHAR as a column type?
    Here are the definitions of the views:
    This is "user_status":
    WITH user_status_data AS
    (SELECT work_user_status_data.person_id,
    MAX(work_user_status_data.startdate) AS startdate
    FROM work_user_status_data
    GROUP BY work_user_status_data.person_id
    SELECT person.id AS tmdid,
    person_a.lastname,
    person_a.firstname,
    person_a.email AS emailaddress,
    person_a.address
    || ', '
    || person_a.zipcode
    || ' '
    || person_a.city
    || ' '
    || person_a.country AS postaladdress,
    person_a.phone,
    person_a.mobile,
    person_a.company AS organization,
    person_a.orgunit_abbr AS orgunit,
    work_user_status_data.pwdresetflag,
    work_user_status_data.lockaccount,
    work_user_status_data.primarypwd,
    work_user_status_data.expdate,
    work_user_status_data.iamtid,
    work_user_status_data.startdate,
    work_user_status_data.stopdate,
    'IN PROGRESS' AS status
    FROM person_a
    INNER JOIN ts
    ON ts.id = person_a.ts_id
    INNER JOIN person
    ON person.id = person_a.person_id
    INNER JOIN user_status_data
    ON person.id = user_status_data.person_id
    INNER JOIN work_user_status_data
    ON user_status_data.person_id = work_user_status_data.person_id
    AND user_status_data.startdate = work_user_status_data.startdate
    WHERE ts."until" IS NULL
    And this is "work_user_status":
    SELECT person.id AS tmdid,
    person_a.lastname,
    person_a.firstname,
    person_a.email AS emailaddress,
    person_a.address
    || ', '
    || person_a.zipcode
    || ' '
    || person_a.city
    || ' '
    || person_a.country AS postaladdress,
    person_a.phone,
    person_a.mobile,
    person_a.company AS organization,
    person_a.orgunit_abbr AS orgunit,
    work_user_status_data.pwdresetflag,
    work_user_status_data.lockaccount,
    work_user_status_data.primarypwd,
    work_user_status_data.expdate,
    work_user_status_data.iamtid,
    work_user_status_data.startdate,
    work_user_status_data.stopdate,
    work_user_status_data.action,
    work_user_status_data.progress
    FROM person
    INNER JOIN person_a
    ON person.id = person_a.person_id
    INNER JOIN work_user_status_data
    ON person.id = work_user_status_data.person_id
    INNER JOIN ts
    ON ts.id = person_a.ts_id
    WHERE ts."until" IS NULL
    Edited by: 931739 on 09.05.2012 06:37

    I just found out that the engineered version (10g) is also quite strange:
    http://public.ceving.de/2012050900/postaladdress_10g.png
    It shows the values in the columns for the types.
    This looks very buggy.
    Is it not recommended to create views with the data modeler?
    Edited by: 931739 on 09.05.2012 06:38

  • Calculation View Issue

    Hi Experts,
    I have created a calculation view which is providing me the condition record number from different pricing tables.
    Below is the snapshot of the calculation view :
    Before adding Join_3:
    The calculation view was working perfectly fine and returning the condition record numbers as below:
    However , after a join was added ( Join_3 ) to get the KBETR from KONP table  based on condition record, no values are returned by the calculation view.
    After adding Join_3:
    Kindly suggest as to why this is happening. Here i have done the join on the values returned by the Union and the KONP table.
    Thanks in advance !!

    Hi Priyaranjan,
    Can you provide some more info like what type of join you have created and on which columns?
    You can do a node level data preview on node 'Union_1' from context menu option, and check the content of table 'KONP'. Check is there any common entires for the columns on which you have created join in node 'JOIN_3'. If there are related entries then data preview should come.
    Regards,
    Rashmi

Maybe you are looking for