ODI variable refresh from a file
In one of the the threads in the past I read some tips about how to refresh a variable from a flat file. I have some information in a flatfile which I need as a variable.
Now I am reading the flat file into a SQL table and then refreshing it into the variable. I guess we can do this in one step. I am sure I read blog something about it. If anyone aware of the thread can you send the link.
Thanks
http://odiexperts.com/?p=243
http://odiexperts.com/?p=243
Similar Messages
-
[solved]variable using ~ from a file
To put the things in short, I am trying to share some files/directory using quickserve and want to pass the file list thro' another file. before actual sharing I am trying to test the actual file's existence but it fails with ~ / $HOME options.
File : ToExport.txt
contents:
~/Documents/File1.dot
~/Documents/File2.ods
/mnt/backup
the said file is passed as an argument to the bash script
Test function ...
for isvalid in $(cat "$1")
do
if [ -e "$isvalid" ]
then
echo "$isvalid passed for sharing"
else
echo "$isvalid does not exisits"
exit 4
fi
done
This fails. If I replace ~ with actual path it works.
(It may be easy to replace the entire list with the actual path by the simple search & replace funtion but the indention is to use the short form ~ or $HOME instead of typing full path.
your inputs/correction are welcome
Last edited by kgas (2010-09-28 17:11:41)This should work:
#!/bin/bash
#: Description : Checks file list to see files contained exist/are empty
fileList=/home/tom/fileList
## Go through each file in the fileList
while read aFile
do
## expand tildes (~)
eval aFile=$aFile
## check file exists
if [ -e $aFile ]
then
## check file is non-empty
if [ -s $aFile ]
then
printf "%s is a file.\n" $aFile
else
printf "%s is an empty file.\n" $aFile
fi
else ## file does not exist
printf "%s does not exist.\n" $aFile
fi
done < <( cat $fileList )
That code is a little more readable too. You where using the variable "isValid" for a file name.
Last edited by BaconPie (2010-09-21 10:29:51) -
ODI: Variable refresh via Jython?
Hello,
I have a very little question, I hope.....
I use the first time project variables with a SQL-Statement for refreshing...
But, how I can refresh this variable via Jython? Even I want to access it says, that no value exists.
IF I refresh manualy it works fine.
How can I init this explicit via Jython?
thanks....Did you try running the sqlldr command on the shell using the same control file ?
I guess it will work fine.
This is an ODI bug 8560194 due to which even if a single record errors out in sqlldr, the ODI signals an error despite the fact that LOA_ERRORS > 0
Hope that helps. -
Can we load data in variable screen from flat file?
Hello all,
One of my user once asked me she needs to run a report for some employees, i said you can just type that in employee varaible input box.
She said I need to run the report and I need it for 120 employees, she has the employee numbers in excel sheet.
What is the best way of doing this if any ?
ThanksThis can be done from a flat file, which has list of all values.
If you are using Bex 3.5, then we have an icon in variable screen bottom right to upload values, where we can specify the path of the file.
Naveen.a -
AS3 send/import variables to/from php file
Hi
im new I would like to send some variables from ac3 to a
php-file. the
php-file have to copperate with this variable (send
querystring to
mysql-server).
ac3 have to read then new variables and traced it on the
screen.
i found some examples on the net but i have not undersood
any.
can you please explane that to me????
SebastianHi
im new I would like to send some variables from ac3 to a
php-file. the
php-file have to copperate with this variable (send
querystring to
mysql-server).
ac3 have to read then new variables and traced it on the
screen.
i found some examples on the net but i have not undersood
any.
can you please explane that to me????
Sebastian -
Format of variable imported from FrameMaker file
When I import my FrameMaker files into RoboHelp, at least one of the variable formats changes. That is, a variable format containing a superscript character gets removed when imported into RoboHelp. Is there a way to fix this variable format in RoboHelp or do I have to convert this variable format to text in FrameMaker before importing into RoboHelp.
I am using the Technical Communicator Suite: FrameMaker 8.0 and RoboHelp 7
ThanksI created a test project and imported one chapter.
The results of the superscript were the same, that is, no superscript: C3 instead of C3. However, there is an exception to this behavior. If there is a cross reference, the cross reference retains the superscript. -
Loading variable from a file in 7.0 Queries
Hi All,
When we run BW 3.x queries through RRMX, we get option to load the variables values via import from file means loading the variables values from a file. Do we have this option available in case of 7.0 queries also as 7.0 queries directly run on portal.
I know via RSRT, i have that option available for 7.0 queries as well.
Thanks in advance.
Sumita.Hi,
Please check out this link. They are requesting to use patch level 14 to the SAP front end.
Re: Clipboard option in BI7
Hope this helps for you.
Thanks,
Arun. -
Loading Variable from a file in BI 7.0 queries
Hi All,
When we run BW 3.x queries through RRMX, we get option to load the variables values via import from file means loading the variables values from a file. Do we have this option available in case of 7.0 queries also as 7.0 queries directly run on portal.
I know via RSRT, i have that option available for 7.0 queries as well.
Thanks in advance.
Sumita.Hi,
In 7.0 it is not possible to load directly from a flat file when you run the query in the portal. However, I don't think it was an option in 3.x either. In het analyzer, both 3.x and 7.0 have that option, only the copy paste functionallity is gone in 7.0, you have to use a flatfile now. Also, in 7.0 portal you can add indivual values for a variable sperated by a ; sign. So you can use excel to create a ; seperated csv file and copy and paste from that.
Kind regards,
Alex -
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
PavanHi 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 -
How to assign a value to ODI Variable using ODI Procedure
Hi ,
Is it possible to assign a value to a ODI Variable using ODI Procedure ?
If it is possible how we can do that.
BEGIN
IF #Counter=1
Then
#Next_Increment:=#Counter+1;
End if;
END;
In my example I have 2 ODI Variables #counter and #Next_increment.
I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
thanks
prasannaPrasanna,
I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
Please help. -
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.
-
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,
JPhttp://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 to store the File Name from a Unix Directory into a ODI variable?
Hi,
I have built a ODI package with the following steps:
1. ODI is polling for a flat file in a Unix directory. I have used OdiFileWait tool for this purpose. Here the file name is not fixed, so I am using wild character (*) to poll for file. Example: DF*ABC1*.DAT where the first wild character denotes 1 letter and the second wild character denotes 2 digits.
2. In the second step, if the file is found, I am moving the file to ODI file server path (../oracledi/demo/file). Here I have used ODIFileMove tool.
3. Then I am using an ODI Interface to Load the file data into a Oracle database table.
4. I am using a Process log table to keep the log for each step I am executing in ODI that is ODIFileWait, ODIFileMove, Interface etc. for each file. In this table a row needs to be inserted after ODIFileWait tool gets the file, with the File Name and File Date. Later on this row will be updated as the consequent steps are executed.
Here is my concern, I need to get the exact File Name of the file after ODIFileWait gets the file and I need to insert that in the Process Log table after the ODIFileWait step gets a file. So if I can store the File Name in a ODI Variable, I can insert it into the Process log table at this point. This I am not able to do.
The files are coming in a different directory (not in ODI file server path), So after getting the file it is moved to ODI file server path (../oracledi/demo/file)
The Files which I am processing are fixed length format. Also, the File name and File Date is stored in the 1st Record(Header record) of the files.
Kindly provide me suggestions to implement this in my code.
Thanks and Regards,
Anik
Edited by: 809820 on Nov 10, 2010 11:36 PMLook at this link -http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory
change the command to fetch the ls command and write into File and then using either java or jython break the data and fetch the file name and date and insert into log table.
(or)
you can use the os.system command and get the complete ls command into string and then process and insert it.
Let us know if you need any other help. -
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.
ThanksLet 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 -
Hi ALL,
Can any one help us regarding How to fecth the Date column(or month column) from the file name specified in the path in a generalized way .
For example :
file name is :subscribers (Cost) Sep13.csv is specified in the below path
E:\Accounting\documents\subscribers (Cost) Sep13.csv
here I need to fetch the "Sep13" as a Date column in the ODI 11g in the generalized way.
Can any one help us in this case as early as possible.I would suggest using a piece of Jython code for this. Something like this...
import os
import os.path
filelist = os.listdir(E:\Accounting\documents\)
for file in filelist:
datestr = file[19:-4]
You'd need to work out what to do with datestr next... perhaps write it to a table or update an ODI variable with it.
Hope this is of some help.
Maybe you are looking for
-
Can any one help as the digital copy downloaded but was processing when iTunes froze and then I had to shut it down. I have the latest version and am using iTunes on a windows PC. I would imagine similar problems could arise on download processing if
-
Need option to list books by File Name
With a good number of books added to ADE, it's sometimes impossible to identify the book from the thumbnail, if it's just the first page of text, for example, and not all pdfs populate the "Title" field either, especially homegrown pdfs. So if Adobe
-
hi i would like to know if it possible to connect the LaCie electron 22 blue (4) to the newest mac mini. thanks
-
Suggest me a good project for m.tech ,give details
hi ,i am studying m.tech(postgraduation) ,i want do my project using Labview ,plz suggest some me good projects and send details
-
Photo Stream Sharing Difficulties
My daughter is currently travelling in China and has shared a dedicated photo stream with me. She's on a 5C running 7 and I'm on a 4S running 7. I have been able to add photos to her stream which she can see, but I can't see any of her photos. She's