How to refresh ODI variables from file

Hi,
I followed the fillowing links to implement the dynamic file parameter passing in to the resource name of a datastore.
part-1. http://odiexperts.com/how-to-refresh-odi-variables-from-file-%E2%80%93-part-1-%E2%80%93-just-one-value
part-2. http://odiexperts.com/how-to-refresh-odi-variables-from-file-%e2%80%93-part-2-%e2%80%93-getting-all-lines-once-at-time
For me first part is working fine where as in second part i made canvas looks like
Vlinevariable(refreshing variable)------------------dyanamicfile(refereshing variable)--------------------- interface.
Interface looks like Flatfile to db ,km's are lkm file------sql and ikm is sql incremental update
Vlinevariable is working fine where i am getting numbers in sequence manner to assign in to code of dynamicfile variable and in dynamicfile is not taking that value in to that code and causing session failed.
The code which i put in a refreshing code of dynamicfile is followed below
select     samplefile1_csv     C1_SAMPLEFILE1_CSV
from      TABLE
/*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=code_generationSNP$CRLOAD_FILE=C:\file/my_test_file.txtSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x0009SNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=1SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=samplefile1_csvSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRACTION_ON_ERROR=0SNP$CR$$SNPS_END_KEY*/
For the firstrow the number has to get from vlinevariable where in my case not working .
In session while loading the interface (load data) i am getting error like
message-------------- ODI-1227: Task SrcSet0 (Loading) fails on the source FILE connection file_tgt.
Caused By: java.sql.SQLException: File not found: C:\file/
     at com.sunopsis.jdbc.driver.file.FileResultSet.<init>(FileResultSet.java:160)
     at com.sunopsis.jdbc.driver.file.impl.commands.CommandSelect.execute(CommandSelect.java:57)
     at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
     at com.sunopsis.jdbc.driver.file.FilePreparedStatement.executeQuery(FilePreparedStatement.java:131)
     at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java:602)
     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeQuery(SnpSessTaskSql.java:3078)
     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java:571)
     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2815)
     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
     at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
     at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
     at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
     at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
     at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
     at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
     at java.lang.Thread.run(Thread.java:619)
source code is select     a     C1_A,
     b     C2_B
from      TABLE
/*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=sample1SNP$CRLOAD_FILE=C:\file/#PROJECT1.FILENAMESNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x002cSNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=1SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=aSNP$CRTYPE_NAME=NUMERICSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=12SNP$CRACTION_ON_ERROR=0SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=bSNP$CRTYPE_NAME=NUMERICSNP$CRORDER=2SNP$CRLENGTH=50SNP$CRPRECISION=12SNP$CRACTION_ON_ERROR=0SNP$CR$$SNPS_END_KEY*/
target code insert into STAGING.C$_0SAMPLE1
     C1_A,
     C2_B
values
     :C1_A,
     :C2_B
KIndly help me and thanks in advance.

ODI is complaning it cannot locate the file. Try replacing the '/' character with a '\' after file in the designated filepath.

Similar Messages

  • How to refresh ODI variable as part of a Knowledge Module?

    Hi,
    I want to know how can i refresh a ODI varaible in a knowledge module using oracle Technology. EX: i have created a variable called VAR_TEST in ODI.
    In one of the knowledge module steps, i want to refresh as mentioned below:
    begin
    select colname into #VAR_TEST from tablename;
    end;
    Many thanks ....

    Hi Martin,
    Put the query in the refresh tab into the variable, generate a scenario from the variable and call the scenario thru "OdiStartScen" (Sunopsis API technology) from KM.
    In this case the variable needs to be "Last Value"
    An alternative is to use a Java variable instead.... Works better to KM's.
    Does it help you?
    Cezar Santos
    http://odiexperts.com

  • ODI - refresh a variable from a file field

    Hi,
    Is it possible to refresh directly a ODI variable from value stored in a file ? I find a workaround by loading the file into a temp table, and then make a variable refresh, but this solution is not good for me.
    Any other idea ?
    Thanks,
    JP

    http://odiexperts.com/how-to-refresh-odi-variables-from-file-%E2%80%93-part-1-%E2%80%93-just-one-value
    gives you the step for refreshing variable from file

  • How do I assign an ODI variable from an Open Tool?

    I'm writing an open tool (a custom tool to use in my ODI flows - a java class that implements oracle.odi.sdk.opentools.IOpenTool
    ). I need to perform a complex calculating in the java Open Tool and 'export' a value back into the ODI world. Idealy, it would be great if I could set a variable in ODI (from within the java world).
    Is this possible?
    If anyone knows the answer, or another way to do this (that might not be as ideal, but works all the same) please let me know.
    Matt.

    Matt
    It is not possible to directly populate an ODI variable, but what you can do is to put the result value into a memory engine table/column, and then to refresh the variable from there. As it is all in-memory, it is fast.
    Craig

  • 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?

  • How can i access filename from file (sender)

    hi All,
    can anybody tell me
    how can i access filename from file (sender)?
    thank u
    swari

    See:
    "SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean"
    SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean
    "Accessing Adapter-Specific Attributes through User Defined Function"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516

  • Assign value to ODI variable from Jython

    Hello Experts,
    I have a procedure where I'm using Jython code. I want to assign a value to an ODI project variable from a Jython function:
    Example:
    #COUNTER = len(v_jythonList) ---> being #COUNTER the ODI project variable and len() the jython function
    Now, i noticed that using ODI variables adds # sign which is use for comments in Jython code. Is there a way to assign values to ODI variables from Jython script?
    Please help!.
    Thanks.
    Pablo.

    Hi,
    Does this post help you :- How to assign value for a ODI variable from Jython Script
    Doc id 424579.1 on metalink should help.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to run ODI scenario from java?

    I am new to java, need to do some testing on how to invoke ODI scenarios from java.
    Can somebody drop me some simple code?
    Thanks a lot,
    Lei

    Hi there
    1. Start your agent (double click agent.bat)
    2. generate scenario for ur package(right click ur package , select generate scenario)
    3. Add the odi-sdk-invocation.jar file to your java project
    ODIcmdScenario=new OdiCommandScenario();
    ODIConnection=new OdiRepositoryConnection();
    ODIConnection.setOdiUser("ur-username");
    ODIConnection.setOdiPassword("ur-password");
    ODIConnection.setJdbcDriver("Driverdetail");
    ODIConnection.setJdbcUrl("url-details");
    ODIConnection.setJdbcUser("dbusername");
    ODIConnection.setJdbcPassword("dbpass");
    ODIcmdScenario.setScenName("scenarioname");
    ODIcmdScenario.setScenVersion("scenarioversion");
    ODIcmdScenario.setLogLevel(5);
    ODIcmdScenario.setContext("context");
    ODIConnection.setWorkRepositoryCode("repository");
    ODIInvocation = new OdiInvocation("hostname", 20910); //20910 default port
    OdiInvocationResult result=ODIInvocation.invokeCommand(ODIcmdScenario,ODIConnection);
    Hope this helps!
    Cheers

  • How to execute ODI scenario from a web application

    Hi
    I need to execute ODI scenario from ApEx form.
    how to execute ODI scenario from application. Using 10.1.3.5.5
    -app

    In the SQL property of the TQuery object, enter the call as an anonymous block:
    begin
      pkg_name.procedure_name(true);
    end;

  • How to read appended objects from file with ObjectInputStream?

    Hi to everyone. I'm new to Java so my question may look really stupid to most of you but I couldn't fined a solution by myself... I wanted to make an application, something like address book that is storing information about different people. So I decided to make a class that will hold the information for each person (for example: nickname, name, e-mail, web address and so on), then using the ObjectOutputStream the information will be save to a file. If I want to add a new record for a new person I'll simply append it to the already existing file. So far so good but soon I discovered that I can not read the appended objects using ObjectInputStream.
    What I mean is that if I create new file and then in one session save several objects to it using ObjectOutputStream they all will be read with no problem by ObjectInputStream. But after that if in a new session I append new objects they won't be read. The ObjectInputStream will read the objects from the first session after that IOException will be generated and the reading will stop just before the appended objects from the second session.
    The following is just a simple test it's not actual code from the program I was talking about. Instead of objects containing different kind of information I'm using only strings here. To use the program use as arguments in the console "w" to create new file followed by the file name and the strings you want save to the file (as objects). Example: "+w TestFile.obj Thats Just A Test+". Then to read it use "r" (for reading), followed by the file name. Example "+r TestFile.obj+". As a result you'll see that all the strings that are saved in the file can be successfully read back. Then do the same: "+w TestFile.obj Thats Second Test+" and then read again "+r TestFile.obj+". What will happen is that the strings only from the first sessions will be read and the ones from the second session will not.
    I am sorry for making this that long but I couldn't explain it more simple. If someone can give me a solution I'll be happy to hear it! ^.^ I'll also be glad if someone propose different approach of the problem! Here is the code:
    import java.io.*;
    class Fio
         public static void main(String[] args)
              try
                   if (args[0].equals("w"))
                        FileOutputStream fos = new FileOutputStream(args[1], true);
                        ObjectOutputStream oos = new ObjectOutputStream(fos);
                        for (int i = 2; i < args.length ; i++)
                             oos.writeObject(args);
                        fos.close();
                   else if (args[0].equals("r"))
                        FileInputStream fis = new FileInputStream(args[1]);
                        ObjectInputStream ois = new ObjectInputStream(fis);
                        for (int i = 0; i < fis.available(); i++)
                             System.out.println((String)ois.readObject());
                        fis.close();
                   else
                        System.out.println("Wrong args!");
              catch (IndexOutOfBoundsException exc)
                   System.out.println("You must use \"w\" or \"r\" followed by the file name as args!");
              catch (IOException exc)
                   System.out.println("I/O exception appeard!");
              catch (ClassNotFoundException exc)
                   System.out.println("Can not find the needed class");

    How to read appended objects from file with ObjectInputStream? The short answer is you can't.
    The long answer is you can if you put some work into it. The general outline would be to create a file with a format that will allow the storage of multiple streams within it. If you use a RandomAccessFile, you can create a header containing the length. If you use streams, you'll have to use a block protocol. The reason for this is that I don't think ObjectInputStream is guaranteed to read the same number of bytes ObjectOutputStream writes to it (e.g., it could skip ending padding or such).
    Next, you'll need to create an object that can return more InputStream objects, one per stream written to the file.
    Not trivial, but that's how you'd do it.

  • How to read some images from file system with webdynpro for abap?

    Hi,experts,
    I want to finish webdynpro for abap program to read some photos from file system. I may make MIMES in the webdynpro component and create photos in the MIMES, but my boss doesn't agree with me using this way. He wish me read these photos from file system.
    How to read some images from file system with webdynpro for abap?
    Thanks a lot!

    Hello Tao,
    The parameter
       icm/HTTP/file_access_<xx>
    may help you to access the pictures without any db-access.
    The following two links may help you to understand the other possibilities as well.
    The threads are covering BSP, but it should be useful for WebDynpro as well.
    /people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    http://help.sap.com/saphelp_sm40/helpdata/de/c4/87153a1a5b4c2de10000000a114084/content.htm
    Best regards
    Christian

  • How to get a value from file to variable in ODI?

    hi
    i created a variable and i want to assign the value of the variable from the flatfile...can v do that ?
    i will be having the value in the flatfile...i want to assign the value to the variable...
    Edited by: sai praneeth on Feb 15, 2009 10:34 PM

    I don`t know how to realize your requirement that assign variable from flatfile directly.
    But I have done this kind of assignment from database table to odi variable.
    So I think, you can transform this variable value in flatfile to database table firstly, and then assign it to odi variable which you want to use.
    Just a kind of solution :-)

  • How to read a string from file & assign the val to a variable in batch file

    Hi,
    How to read a string from a file and assign the value to a variable then return the value to the screen in windows batch file?
    Any suggestions?
    thanks.

    Unless this is a homework question then I don't see the purpose of doing this, but....
    You should be looking a the supplied package utl_file to get the string out of the file, dbms_output to display the string and then google windows batch/command files calling sqlplus to execute your program.
    Andre

  • 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

  • Refreshing ODI Variable through startscen.bat

    Hi,
    I am trying to refresh an ODI variable using startscen.bat Batch file.. I need be sending the variable value through cmd so that ODI variable gets refreshed with input value..
    Can you please give me the syntax for the same.
    Thanks

    Let me explain my scenerio:
    I have a variable defined in ODI as "SCEN_TEST" This variable needs to be refreshed from a csv file present on a my local machine.
    Say the csv file has a single column and multiple rows in it:
    CSV File:
    TEST1
    TEST2
    TEST3
    I have created a batch file ..
    I have a CMD command in batch file which creates a for loop which will pick up each row from the csv file.
    When the for loop starts in cmd it will pick up TEST1 on its first run , TEST2 on its second etc..
    So i need to refresh the ODI variable with TEST1 during first instance , TEST2 during second run etc.
    So i am calling the scenerio of the variable using startscen.bat <<scen_name>> <<version>> <<context>>
    Now my problem is i need to refresh the ODI variable by the value "TEST1" "TEST2" during consecutive runs..
    (Note : I am not inputting the variable value using startscen.bat but i need to refresh the ODI variable by calling variable scenerio)
    Thanks

Maybe you are looking for

  • InDesign/InCopy 7.5.3 is out [ANN]

    You can tell CS6 is getting close. Adobe has released InDesign and InCopy (and InDesign Server) version 7.5.3.333. Release notes at http://helpx.adobe.com/indesign/release-note/release-notes-indesign-cs5-51.html (well, linked from http://www.adobe.co

  • Difference between OC4J Standalone & IIS for BI Presentation services

    Hi experts, i had this question in my mind for last couple of weeks and did not get good answer by self study. my understanding with IIS & OC4J server is, 1.if BI Presentation services is setup to IIS Webserver, It is also using OC4J as application s

  • Navigate pages of tab control with radio buttons

    hi guy, i need to navigate 7 pages of a tab control container usings custom buttons. that is, when i click on a button, i takes me to the specific page on the tab control container. i think this can be done using radio buttons and tab control contain

  • How do you sort by city?

    Use Act with Companionlink and have over 1000 contacts. When traveling I like to have them grouped by city, then by company. How can i do this?

  • DirectX hangs when a program needs it to be installed

    Hi all, I have a problem with installing directx on win 8.1. When a programm needs it it starts the installation but the process (dxsetup.exe) hangs without using any ressources. The same happens when I try to install directx again from the windows w