Using ODI variable in Header File

Hi,
I want to append header/footer file to the main data file.
Is it possible to do this:
1) I want to write to the header file - table name, rowcount, .. and various other detials. But i do not want to use an interface/odioutfile/odisqlunload for this.
2) I want to use ODIvariables and write the varaible value to Header.txt file.
Is such a thing possible?
If NO, then what could be the other soultion?
Thanks.

Thanks Dev.
I followed the following steps
1. Refresh the variable for header (OK)
2. Call the Variable using OdiOutFile [ Header is populated ] (OK)
3. Call the Interface SQL to File Append [ In the option have the Header as no since you are getting the Header from the Variable ] (OK )
When I see my output file its coming as this
2stt_acct:1234 (2 is the row count - supposed to be a separate line)
stt_acct:5678
I wanted the file to be the following
2 (header representing row counts)
stt_acct:1234
stt_acct:5678
How can I make this happen

Similar Messages

  • Dymanin File Name Creating Using ODI variable

    Hi All,
    I am trying to create a flat file dynamically using ODI variables. I am following a document in metalink (Using A Dynamically Specified File Name Or Directory Name With ODI [ID 423635.1]). However, I am getting the following error, whenever I try to execute the interface:
    java.lang.NullPointerException
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    IKM: IKM SQL to File append
    I am sure that it is unable to locate the file. May be the variable value is not passed, not sure. But, if I mention a name like abc.txt, it works. It creates a new file with abc.txt. However, when I try to use a variable, it throws null pointer exception.
    Thank you
    KK

    Hi Nitesh,
    I am really not sure what exactly you mean by declare a variable in a script. I create a new variable and used it as a name for the flat flie model. I defined a SQL that contactenates sysdate with a string. Thank you for your help!
    Regards,
    KK

  • Using ODI Variable in Topology

    Since my source databases are many in number I am trying to use ODI Variable in topology to access the Source Databases details from a Table.
    Please can anyone help me here....

    Have a read here for details on using variables in topology.
    Ok?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Using environment variable in rule file

    Hi,
    I want to datacopy from one cube (scenario Forecast) to another (scenario FcstJan, FcstFeb, and so on) based on which month is running currently. I want to use environment variable in the rule file. The Forecast data will be extracted in .txt and will be imported to the second cube in FcstJan if current month is Jan and same for Feb, Mar..... The CurrentMth will be my env variable.
    Can anyone please let me know how I can use that variable in the rule file. Or, if there is any other way to load the same.
    Thanks.

    You could just set a substitution variable and then use the substitution variable in the header of the rule.
    Have a read of :- Re: Data error
    to understand about using substitution variables in the header of a rule file.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to use ODI Variables in Jython

    Hi, im doing a dynamic interfaz .. so i make a connection to bd.
    When i try to do it .. i got an error...
    How can i access to the odi variables from odi..
    this is my code ..
    <%
    import java.sql.*;
    import java.io.*;
    BufferedWriter bw = new BufferedWriter(new FileWriter("c:\log.txt"));
    StringBuilder strB = new StringBuilder();
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String ip = "#PROJECT.IP";
    String url = "jdbc:oracle:thin:@"+ip+":1521:orcl";
    Connection con = DriverManager.getConnection(url,"snpw","admin");
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
         bw.write(" raise(' ");
         out.print(" raise(' ");
    String str = "SELECT c.var_name,d.project_name FROM snp_package a JOIN snp_step b On (a.i_package = b.i_package) JOIN snp_var c ON (b.i_var = c.i_var) JOIN snp_project d ON (c.i_project = d.i_project) WHERE UPPER(pack_name) = upper('DebugJava')";
    ResultSet rs = stmt.executeQuery(str);
    while(rs.next()){
    String var_name = rs.getString("var_name");
    String project_name = rs.getString("project_name");
    out.print(var_name+" #" project_name"."+var_name+"\n ");
    bw.write("#STUFF."+var_name);
    bw.write("')");
    out.print("')");
    rs.close();
    bw.close();
    stmt.close();
    con.close();
    %>
    this is the error ...:
    The application script threw an exception: java.sql.SQLException: Excepción de E/S: The Network Adapter could not establish the connection BSF info: DebugVariables at line: 0 column: columnNo
    Iknow tha is taking "#PROJECT.IP" like my ip .. but there is a variable that is on my package with a assiged value 127.0.0.1
    but jython is not taking it !!
    I make a raise to the variable .. and yes the variable take de value "127.0.0.1" but not in my jython code
    note: My variable is linked with OK to the jython procedure on my package
    Can i acces to the variable? from jython how?.
    Thanks in advanced!!
    Edited by: user11334562 on 28-abr-2010 15:12

    1. This is not a jython code, this is beanshell code. Anything you put between <% and %> is beanshell code which is sort of a parser code for ODI. Check out
    http://www.beanshell.org/
    2. Your expression for "url" variable is wrong. If you want to concatenate strings, you have to use + sign i.e it should be:
    String url = "jdbc:oracle:thin:@"+ip+":1521:orcl";
    Other statments need to be adjusted similar way.
    3. Why would you want to go through so many trouble? Just extract the SQL into a file using ODI SQLUnload tool. The sql should be:
    SELECT c.var_name||' #'||d.project_name||'.'||c.var_name FROM snp_package a JOIN snp_step b On (a.i_package = b.i_package) JOIN snp_var c ON (b.i_var = c.i_var) JOIN snp_project d ON (c.i_project = d.i_project) WHERE UPPER(pack_name) = upper('DebugJava')
    4. How does printing a set of variables from a particular package help you to write dynamic interface?

  • HELP--using a program's header file!

    Ok, I have gone thru the jni tutorial and I understand the HelloWorld example... my problem is, in the tutorial the java part calls a C program that they then write... I need to call an existing program that is not written in java? I have this program's header file and that is all.
    How do I use this so that my java program can call the existing non java program? What do I do with it, how should/do I make the dll? The methods sigs. in the non java program's header file do not look like the ones created by javah.exe.
    please help, and thanks in advance

    What you need to do is
    1. Design nice java methods that are the equivalent of the C functions. Define them as "native" - no implementation in java.
    2. run javah and generate an h file for those methods.
    3. Write a dll in c for the new javah-generated .h file. This will be a very thin layer that translates between java and the original dll. In other words, your new dll mostly just calls the functions in the old dll.

  • How to use odi variable in java code.

    Hi,
    I am trying to calculate check sum of a file and need to capture that in a odi variable...
    I wrote code like this(selected technology as java bean shell)
    <@
    import java.io.*;
    import java.util.zip.*;
    public class checksum {
    public static void main(String[] args) throws Exception {
    FileInputStream fis = new FileInputStream(new File("c:/dummy.txt"));
    CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
    BufferedInputStream in = new BufferedInputStream(cis);
    while (in.read() != -1) {
    #checksum = cis.getChecksum().getValue();
    }@>
    But I am not able to get that value...
    I tried in another way like this
    <@
    import java.io.*;
    import java.util.zip.*;
    public class checksum {
    public static void main(String[] args) throws Exception {
         long result;
    FileInputStream fis = new FileInputStream(new File("c:/dummy.txt"));
    CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
    BufferedInputStream in = new BufferedInputStream(cis);
    while (in.read() != -1) {
    result= cis.getChecksum().getValue();
    @>
    In odi variable refreshing mode i selected schema as memory_engine and wrote
    select '<@=result@>' from dual;
    even this wont work for me :(
    Anyone pls help me in this...
    Thanks in advance
    Pavan

    Hi Phani,
    Thanks for the reply. I resolved this. The mistake is I wrote java code in a class,in main function. I removed class and main function. Now I am able to capture value into Odi variable...
    I modified code as
    <@
    import java.io.*;
    import java.util.zip.*;
         long result;
    FileInputStream fis = new FileInputStream(new File("C:/dummy.txt"));
    CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
    BufferedInputStream in = new BufferedInputStream(cis);
    while (in.read() != -1) {
    result=cis.getChecksum().getValue();
    @>
    finally retrieving result value from dual
    select '<@=result@> from dual
    Edited by: 908443 on Jan 16, 2012 10:42 PM

  • Using Cpp code and header files with LV8 CIN

    Hello,
    I have three pieces of C++ code and their header files that are called from a Main C++ code.  I want to call these from a LV8, code interface node (CIN).  I have the C++ compiler installed on teh same machine as LV8.  My questions are:
    1) How do I call the C++ code anf the header files from the LV CIN?  I have never doen this. Is there a concise manul for this somewhere?  Teh last thing any self-respecting engineer wants to do is read the manual.
    2)  Once I successfully call teh C++ and header files from within the CIN, can I create a LV runtime executable, just as I can with any other LV8 .vi?  Will this runtime .exe run stand-alone as a distribuatble application?  Do I need to include any special runtime files when I build the exectuable to support teh C++ code?
    Thank you.

    http://forums.ni.com/ni/board/message?board.id=231&message.id=2424&requireLogin=False
    handles your question.

  • How to create a table using a variable or flat file ?

    Hello All,
    I want to create a table in which column names and data type will be read from a flat file or a variable.
    How can i do this ? Any suggestations are appricaible.....
    Regards,
    Ashish

    How about using this code.
    Used Directory object EXT_DIR where the input file abc.txt is located with the below mentioned data
    TABLE SANJ_TEST
    SANJ_AB NUMBER(6)
    SANJ_BC VARCHAR2(100)
    Declare
    v_file utl_file.file_type;
    z varchar2(100);
    v_cnt number :=0;
    v_str Varchar2(1000) :='';
    v_tab varchar2(40);
    v_col varchar2(30);
    v_data_type varchar2(30);
    Begin
    v_file := utl_file.fopen('EXT_DIR','abc.txt','r');
    loop
    utl_file.get_line(v_file,z);
    if substr(z,1,5) = 'TABLE' then
    if v_cnt <> 0 Then
    v_str := v_str||')';
    execute immediate v_str;
    end if;
    v_cnt := 0;
    v_str := 'Create Table ';
    v_tab :=Ltrim(Rtrim(substr(z,7)));
    v_str := v_str||v_tab||'(';
    Else
    dbms_output.put_line('count in else start '||v_cnt);
    v_col := ltrim(rtrim(substr(z,1,30)));
    v_data_type := ltrim(rtrim(substr(z,31)));
    if v_cnt=0 then
    v_str := v_str||v_col||' '||v_data_type;
    else
    v_str := v_str||','||v_col||' '||v_data_type;
    end if;
    v_cnt := v_cnt+1;
    End if;
    End loop;
    utl_file.fclose(v_file);
    Exception
    When NO_DATA_FOUND then
    v_str := v_str||')';
    execute immediate v_str;
    dbms_output.put_line('In excep '||sqlerrm);
    utl_file.fclose(v_file);
    End;
    /

  • How to use local variables in control files for loading data

    i want to count the number of records which have odd number like...
    Data in data.txt
    1 a
    2 b
    3 c
    So my count = 2, i will write this to another file.
    Plz help me how to achieve this

    If you want to extract some rows from a file and write them to another one, why do you need Oracle? What is your requirement?
    Or are you asking out of curiosity how can this be done in Oracle?
    You can create an external table for this input file, select the rows you want from it and write them to another file using utl_file.
    External tables: http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/et_concepts.htm#SUTIL011
    UTL_FILE: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14095

  • How to use env variables in config files?

    i created a folder in /etc/skel called .arch to hold some wallpapers and icons relating to arch. this ended up in a new users folder as it should. well i use lxde and pcmanfm. what i did was go into the /.config/pcmanfm/LXDE/pcmanfm.conf and change the wallpaper and menu icon path to $HOME/.arch/wallpapers/filename but it didn't seem to work. if i actually put /home/user/.arch/wallpaper/filename it works. is there a way around this? so i can default the new wallpapers to the folder i created?
    or should i be putting these in /opt or /usr somewhere?

    Could you please paste here the exact part of the config file? (Edit: Some time ago I encountered a similar issue and in my case removing the quotation marks solved the problem. Try doing the similar: either use quotes, be it " " or ' ', or remove them and see if this helps.)
    Last edited by bohoomil (2011-10-01 23:34:24)

  • ODI - IKM SQL to File Append - Header not Generated

    I'm using ODI IKM SQL to File Append to create a text file, but the header is not being generated. And the GENERATE_HEADER is set to Yes. The file is Tab delimited and the Heading (number of lines) is set to 1.
    Seems to only be an issue with HFM files coming from the Unix server.
    Any suggestions?
    Thanks, Mike

    Ok, getting the following error in step 6 - Integration - HFM_EA_Translate - Insert Column Headers
    java.lang.NumberFormatException
         at java.math.BigDecimal.<init>(BigDecimal.java:459)
         at java.math.BigDecimal.<init>(BigDecimal.java:728)
         at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.addBatch(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:662)
    The last two columns in the file are numeric which seems to be causing the issue. Will change formatting for the two columns (String, Numeric, etc.) to see if I can resolve the header issue.
    Thanks,
    Mike

  • Error while using  odi out file

    hi all
    Am using odi out file for displaying error in separate file.
    If i give the path of the file in target file directly am getting the error properly loading inside text file.
    Is it possible to assign the target file path in variable and use that variable in target file of odi out file ?
    can u pls tel me whether using variable for target file location is possible, if so please tel how to do it
    Edited by: user12209948 on Sep 26, 2011 2:16 AM

    Hi,
    use the physical schema and get the path using ODIRef Functions for example ODIFileMove
    OdiFileMove "-FILE=<%=odiRef.getSchemaName(""FILE_LOGICAL"", ""D"")%>/#PROJ_X.vFileName" "-TOFILE=<%=odiRef.getSchemaName(""FILE_LOGICAL"", ""D"")%>/#PROJ_X.vFDir/#PROJ_X.vNewFile" "-OVERWRITE=NO" "-CASESENS=NO" "-RECURSE=NO"
    This command moves the file with vFileName to a vNewFile in a another directory
    FILE_LOGICAL is the logical schema name mapped to physical schema say your target directory ( eg C:\test )
    Same logic applies to ODIOutFile
    Edited by: john z on Sep 26, 2011 9:41 PM

  • How to use Dlls and Header files in my java Code?

    Hi All,
    I want to make use of dll and header files of DataStage, from my Java Interface.
    i am buliding a product where i need to contact DataStage server from my Java Code alone, For this they provided dlls and header files
    Now i wan to make use of them and need to perform DataStage operations from my Java Interface.
    Can any on help out me regarding this?

    Try Java Platform SDK for native function calls without JNI writing code, like it done in .NET languages.
    For MS Windows:
    http://www.simtel.net/product.php[id]100916[SiteID]simtel.net
    For Linux/Unix:
    http://www.simtel.net/product.php[id]117719[SiteID]simtel.net

  • Unable to load Dimension into Hyperion planning using ODI ?

    Hi All
    We are trying to load Dimension into hyperion planning Ver. 11.1.2 using ODI. We have created the interface and mapped the source csv file to target planmning application using ODI KM.
    LKM file to SQL
    IKM SQL to Planning
    We get success in ODI's Operator but the Dimension is not updated nor new data is insreted.
    We get this message in Error file:-
    +
    Retail Format,Parent,Alias: Default,Data Storage,Two Pass Calculation,Smart List,Data Type,Plan Type (APlan),Error_Reason
    ABC,Total Format,,StoreData,,,,Aplan,Cannot load dimension member, error message is: java.lang.RuntimeException: Fetch of saved member "ABC" failed.
    +
    We get this message in log files:-
    +
    2010-07-22 07:04:06,550 INFO [DwgCmdExecutionThread]: Oracle Data Integrator Adapter for Hyperion Planning - Release 9.3.1.1
    2010-07-22 07:04:06,550 INFO [DwgCmdExecutionThread]: Connecting to planning application [******] on [********]:[11333] using username [admin].
    2010-07-22 07:04:06,597 INFO [DwgCmdExecutionThread]: Successfully connected to the planning application.
    2010-07-22 07:04:06,597 INFO [DwgCmdExecutionThread]: The load options for the planning load are
         Dimension Name: Retail Format Sort Parent Child : false
         Load Order By Input : false
         Refresh Database : true
    2010-07-22 07:04:06,612 INFO [DwgCmdExecutionThread]: Begining the load process.
    2010-07-22 07:04:06,612 DEBUG [DwgCmdExecutionThread]: Number of columns in the source result set does not match the number of planning target columns.
    2010-07-22 07:04:06,659 INFO [DwgCmdExecutionThread]: Load type is [Load dimension member].
    2010-07-22 07:04:06,675 ERROR [DwgCmdExecutionThread]: Record [[ABC, Total Format, null, null, StoreData, null, null, null, null, null, null, null, null, null, Aplan, null, null, null]] was rejected by the Planning Server.
    2010-07-22 07:04:06,675 INFO [DwgCmdExecutionThread]: Planing cube refresh operation initiated.
    2010-07-22 07:04:08,425 INFO [DwgCmdExecutionThread]: Planning cube refresh operation completed successfully.
    2010-07-22 07:04:08,425 INFO [DwgCmdExecutionThread]: Load process completed.
    +
    Please help out .....

    Can you check the error log file as you have posted the log file, it should give more information to why the records were rejected.
    Cheers
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for

  • Different material description for RG1 register

    Dear Experts, I have a client requirement for change in material description (materialmaster) to a different description. The description maintained in material master is for viz SS CT BT 200mm-123-093MKO But excise need description SS BILLET Where t

  • Cannot open my iphoto library after iphoto upgrade

    - i have a newest iphoto 11, latest update - all my libraries are backuped with a timemachine - my iphoto library has 118GB (unfortunatelly) - new iphoto cannot open my library - i tried restore library from a time machine to a new location, iphoto c

  • Downpayment facility in PO creation itself in EHP 4

    I am on EHP 4. In this EHP 4, i can give downpayment (DP) percentage in PO itself. There are three DP Category: 1. Mandatory downpayment 2. Voluntary downpayment 3. No downpayment I selected 1st option. When i did MIRO, i thought that the amount ment

  • My ipad is frozen with the spinning circle in the middle that continues to spin and spin.

    I tried holding the home button and the sleep button and nothing happens.  I also tried to see if it would connect to itunes and no such luck. Is all hope lost??  Don't know what to do now...

  • Returning arrays using JNI

    Hi all, Hi, I am in the process of accessing the MS cryptoPI using java-jni-CryptoAPI. SO far i have been able to suceesfully acessing the cryptoapi functions. There are certificate stores istalled in our windows OS called "root", "CA" and "My" .Each