Comparing data from an array
Hi all
I have a little problem regarding the use of arrays and obtaining the integer value from an index of one of the columns. I need to implement a program that reads data from serial ports. There are four serial ports and it is assumed that independant sets of data will be retrieved from each of these. I need my program to continuously loop and check to see if the data has changed at any of the serial ports (i've got this part working). The way it can be manually determined is if the file is opened and at the top of the data there is the error number which is incremented every time the data is changed. I have put the data into a 2D array for later use and have then put just the first column into a single array in the hope of bein
g able to convert it to an integer or some form that can be compared. I need the highest error number for each peripheral to be stored (probably need separate loops/case for each serial port? - multitasking?) and when the data is next sent, i need to be able to compare it to see if the error number has changed and if it hasn't just continue looping and if it has make the new value the highest (in which case the rest of the data needs to manipulated and automatically updated in the database). I have been thrown head first into this project and to this date had only been a casual Labview programmer (V6i)
Can anyone help?
Ive attached the snippet that is for comapring the data only if anyone can build upon it (or scrap it!)
Thanks
Ridge
Attachments:
Array.vi 31 KB
To compare the error is easy,attached is a little modification to your vi with shift register and Array max and min function. I'm not sure if this is the only problem.
Attachments:
Array[1].vi 38 KB
Similar Messages
-
Without loops how can i read data from associative Array??
Hi all,
I am facing scenario like...
i need to read data from associative array without using loops is it possible,
CREATE OR REPLACE PACKAGE BODY test_pkg IS
TYPE t1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
-- in array we can expect more than one row or sometimes no data also.
FUNCTION test1(vt1 T1 DEFAULT CAST(NULL AS t1)) RETURN NUMBER IS
BEGIN
-- basically in array we'll get data of column2
-- this loop should satisfies table1.colum2 = nvl(NULL, table2.colum2 )if array is null.
-- if array is not null then only compare with array values
FOR i IN (SELECT t1.colum1,t1.column2
FROM table1 t1, table1 t2
WHERE t1.colum1 = t2.column1
AND t1.colum2 = nvl(vt1, t2.colum2)
LOOP
generateTEXT(i.colum1, i.colum2);
END LOOP;
END test1;
END test_pkg;
in table1 we have date like...
colum1 column2
Jan 1
Feb 2
Mar 3
if i call select test_pkg.test1(1) from dual then output should
be Jan..
and
select test_pkg.test1(null) from dual then it should display all elements from table1.
Jan 1
Feb 2
Mar 3,
Thanks for your quick replay..i need to read data from associative array without using loops is it possible,
No - you would need to create a SQL type and then use the TABLE operator to unnest the collection.
create or replace TYPE my_nums IS TABLE OF INTEGER;
DECLARE
-- TYPE my_nums IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
v_nums my_nums := my_nums(1, 2, 3);
v_total number;
BEGIN
select sum(column_value) into v_total from table(v_nums);
DBMS_OUTPUT.PUT_LINE
('Sum of the numbers is ' || TO_CHAR(v_total));
END;
Sum of the numbers is 6 -
Hello, I am trying to compare data from one and the same table. In short I have:
NAME DTM CHARGE
Atanas 8/18/2012 9:33:23 AM 100
Atanas 8/18/2012 9:33:23 AM 101
Niki 8/18/2012 9:33:43 AM 200
Niki 8/17/2012 9:34:10 AM 100
Niki 8/18/2012 9:33:43 AM 201
Niki 8/17/2012 9:34:10 AM 101
Atanas 8/17/2012 9:34:29 AM 50
Atanas 8/17/2012 9:34:29 AM 51
Joro 8/18/2012 12:10:12 PM 400
Joro 8/17/2012 12:10:21 PM 300
Joro 8/18/2012 12:10:12 PM 401
Joro 8/17/2012 12:10:21 PM 301
And I want to sum CHARGE for each DTM for each NAME and present the difference in an additional column, the output should be like that:
NAME DTM CHARGE DTM CHARGE DIFFERENCE
Atanas 8/17/2012 9:33:23 AM 101 8/18/2012 9:33:23 AM 201 - 100
Niki 8/17/2012 9:33:23 AM 201 8/18/2012 9:33:23 AM 401 - 200
Joro 8/17/2012 9:33:23 AM 601 8/18/2012 9:33:23 AM 801 200
the DTM will be always /sysdate - 2/ and /sysdate - 1/,
Thanks in advance!It is not clear what you are trying to do, but it looks like:
with sample_table as (
select 'Atanas' name,to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am') dtm,100 charge from dual union all
select 'Atanas',to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),200 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),100 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),201 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),50 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),51 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),400 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),300 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),401 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),301 from dual
select nvl(s1.name,s2.name) name,
s1.dtm,
s1.charge,
s2.dtm,
s2.charge,
s2.charge - s1.charge diff
from (
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate) - 1
and dtm < trunc(sysdate)
group by name,
dtm
) s1
full join
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate)
and dtm < trunc(sysdate) + 1
group by name,
dtm
) s2
on s1.name = s2.name
NAME DTM CHARGE DTM CHARGE DIFF
Atanas 17-AUG-12 101 18-AUG-12 201 100
Niki 17-AUG-12 201 18-AUG-12 401 200
Joro 17-AUG-12 601 18-AUG-12 801 200
SQL> SY. -
Error while retrieving data from an ARRAY resultset
We hava an Oracle stroed procedure which has a table type as its OUT parameter and where the data is being entered into. This data requries to be returned to the Java client through a JDBC connection. We have used the OracleTypes' ARRAY object for this. We are facing errors when retieving data from the ARRAY resultset
The Oracle Package
----I created a table type called "PlSqlTable":
CREATE OR REPLACE TYPE PlSqlTable IS TABLE OF VARCHAR2(20);
----I defined this as the out parameter for my procedure :
PROCEDURE testSQL
arrayOutID OUT PlSqlTable
Then populated the object :
arrayOutID := PlSqlTable();
arrayOutID.extend(4);
arrayOutID(1):= 'Hello';
arrayOutID(2) := 'Test';
arrayOutID(3) := 'Ora';
----The procedure executes fine - all debug statements are printed ----right till the end of execution.
The Java class
----Here is how I have defined the parameters :
OracleCallableStatement stmnt = (OracleCallableStatement)connection.prepareCall("begin testSQL(?);end;");
stmnt.registerOutParameter(2,OracleTypes.ARRAY,"PLSQLTABLE");
System.out.println("Executing..");
stmnt.execute();
System.out.println("Executed..");
ARRAY outArray = stmnt.getARRAY(1);
System.out.println("Got array");
ResultSet rset = outArray.getResultSet();
System.out.println("Got Resultset..");
int i = 1;
while(rset.next()){
System.out.println("VALUE : " + rset.getString(i));
i = i+1;
----On execution, the debug messages display :
Executing..
Executed..
Got array
Got Resultset..
VALUE : 1
VALUE : Test
ERROR : java.sql.SQLException: Invalid column index
----But I have populated upto 3 values in th e procedure. Then why this error ?
PLLLEEEASE help me out on this.
Thanks, Sathyahaven't worked with db arrays but I think your problem is here:int i = 1;
while(rset.next()){
System.out.println("VALUE : " + rset.getString(i));
i = i+1;
}In the first loop you are retrieving the value from column 1(rs.getString(1)), which is OK, but in the second loop, you are trying to retrieve a value from the second column(rs.getString(2)) which doesn't exist. Try this code which only reads from column1:
while(rset.next()){
System.out.println("VALUE : " + rset.getString(1));
}Jamie -
How to delete a particular data from 3 arrays
hello,
i have a program that works like this.....
import java.io.*;
public class NewMain {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String [] Type= new String[10000];
int [] Num= new int[10000];
float [] Price= new float[10000];///////
and i am reading some of the data into these arrays
so if i want to delete a particular data from the arrays how do i do that
and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
e.g if the file contains
shirt
32
56.5
pants
56
45.9Ashish.Uppin wrote:
hello,
i have a program that works like this.....
import java.io.*;
public class NewMain {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String [] Type= new String[10000];
int [] Num= new int[10000];
float [] Price= new float[10000];///////
and i am reading some of the data into these arrays
so if i want to delete a particular data from the arrays how do i do that
and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
e.g if the file contains
shirt
32
56.5
pants
56
45.9
Buddy, it seems to me that you are describing data that belongs together -- a class. You are probably better off with one arraylist of objects of this class, each object having a String type variable, an int num variable, and a float price variable, make that a double price variable.
For examples of arraylists in action, please see the Sun java tutorials. -
What is the best way to move data from one array to another
I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
The RAID has 450GB of production files, fonts etc.
What is the best way to move the data over?
I saw that someone had suggested using ditto. Would that be better than MacMV?
I also own Bru LE so I could use that.
Any advice would be appreciated.
Thanks,
PaulDitto is a great option -- probably the best.
ditto -rsrc src_folder /Volumes/targetvolume/targetfolder -
How to compare data from 2 different time periods
Hi folks,
I have a question on approach to a problem. I want to be able to compare data from a common db, but for 2 different time periods. For example I want to see the number of occurences of an instance in my data for today and compare it against occurences a week ago today. What's the best approach for this kind of problem? Is this done with 2 separate queries from 2 sub reports and then compared some how? Any comments on this approach or an other are appreciated.
TIA bvdFollow these steps:
1) Bring your first time period in your main report. This will be your first query.
2) Bring your second time period in a subreport. This will be your second query.
3) Bring the values from your subreport into your main report using shared variables.
4) Lastly, compare the results using formulas in your main report.
I hope this information proves useful.
Regards,
Zack H. -
Question - Comparing data from 2 databases
I'm new to Oracle - I'm trying to compare data from 2 separate databases.
I'm trying to get data from both databases based on a common TRACKING_NUMBER. The issue is that in one database there are additional 0s in front of the Tracking_Number.
So I'm trying to find out what I can put in my query to remove those zero's in front of the tracking number. I have the query below - it's very long.
SELECT DISTINCT cm.TRACKING_NUMBER_TYPE AS HType,
TRUNC(cm.CREATED_DATE) as CodeMoveDate,
SUBSTR(cm.CODE_MOVE_DESC, 1, 50) AS Description,
cm.TRACKING_NUMBER AS TrackingNumber,
rq.Plant_Name as Location,
jr_eur.Assignee as Tracker,
TRUNC(MAX(jr_spec.Journal_Date)) as Date_Spec,
TRUNC(MAX(jr_app.Journal_Date)) as Date_Approved,
TRUNC(MAX(jr_ut.Journal_Date)) as Date_Unit,
TRUNC(MAX(jr_qa.Journal_Date)) as Date_Assurance,
TRUNC(MAX(jr_eur.Journal_Date)) as Date_Enduser,
TRUNC(MAX(jr_gv.Journal_Date)) as Date_Gatekeeper,
TRUNC(MAX(jr_prod.Journal_Date)) as Date_Move,
TRUNC(MAX(jr_eun.Journal_Date)) as Date_Notification,
TRUNC(MAX(jr_pver.Journal_Date)) as Date_Production,
TRUNC(MAX(jr_udoc.Journal_Date)) as Date_Documentation
FROM PROJMAN.PM_CODE_MOVES_V cm,
PROJMAN.PM_Requests_V rq,
PROJMAN.PM_Journals_V jr_spec,
PROJMAN.PM_Journals_V jr_app,
PROJMAN.PM_Journals_V jr_ut,
PROJMAN.PM_Journals_V jr_qa,
PROJMAN.PM_Journals_V jr_eur,
PROJMAN.PM_Journals_V jr_gv,
PROJMAN.PM_Journals_V jr_prod,
PROJMAN.PM_Journals_V jr_eun,
PROJMAN.PM_Journals_V jr_pver,
PROJMAN.PM_Journals_V jr_udoc
WHERE cm.TRACKING_NUMBER = LTRIM(rq.Request_ID(+))
AND cm.TRACKING_NUMBER = jr_spec.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_app.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_ut.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_qa.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_eur.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_gv.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_prod.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_eun.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_pver.Request_ID(+)
AND cm.TRACKING_NUMBER = jr_udoc.Request_ID(+)
AND jr_spec.Journal_Status(+) = 'Spec Doc'
AND jr_app.Journal_Status(+) = 'Approved'
AND jr_ut.Journal_Status(+) = 'Unit Test'
AND jr_qa.Journal_Status(+) = 'Quality Assurance'
AND jr_eur.Journal_Status(+) = 'End User Review'
AND jr_gv.Journal_Status(+) = 'Gatekeeper Verificat'
AND jr_prod.Journal_Status(+) = 'Move to Production'
AND jr_eun.Journal_Status(+) = 'End User Notificatio'
AND jr_pver.Journal_Status(+) = 'Production Verificat'
AND jr_udoc.Journal_Status(+) = 'User Documentation'
AND cm.TRACKING_NUMBER_TYPE = 'H'
and cm.CREATED_DATE >{d '2006-12-31'}
GROUP BY
cm.TRACKING_NUMBER_TYPE,
TRUNC(cm.CREATED_DATE),
cm.CODE_MOVE_DESC,
cm.TRACKING_NUMBER,
rq.Plant_Name,
jr_eur.Assignee
ORDER BY TRUNC(cm.CREATED_DATE)I recommend using a product.
I used to write scripts and procedures, but no more!
Reason is: you save time. A lot of time. You pay few hunderes $ once for the product.
If you do it yourself, you waste half-days doing it properly.
A good tool for database compare is Comparenicus (www.compareniucs.com).
I'm using it for 6 months now and it saves me a lot of time. -
How to insert 300 data from associative array to backend table in PL/SQL
HI ALL,
I'm posting my code here:
Creating back end table:
Create table orlando
( id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
Creating package:
CREATE OR REPLACE PACKAGE r IS
type apollo_rec is record(
id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
TYPE bin_array IS TABLE OF apollo_rec INDEX BY BINARY_INTEGER;
PROCEDURE rr (state_array bin_array);
END ;
SET SERVEROUT ON
CREATE OR REPLACE PACKAGE BODY r IS
PROCEDURE rr (state_array bin_array) IS
BEGIN
FOR i IN 1 .. state_array.COUNT LOOP
INSERT INTO orlando(id,calltype,gateway_name,accounting_id,start_time_system_ticks)VALUES(state_array(i).id,state_array(i).calltype,state_array(i).gateway_name,
state_array(i).accounting_id,state_array(i).start_time_system_ticks);
COMMIT;
END LOOP;
END ;
END ;
I've run this code in i*SQL PLUS.But when I run this code for 5 entries there is no error but when I modify the insert statement for 300 entries(300 identifiers in the insert statement)
it gives me error:
Warning: Package Body created with compilation errors.
Errors for PACKAGE BODY R:
LINE/COL ERROR
7/2 PL/SQL: SQL Statement ignored
7/14 PL/SQL: ORA-00913: too many values
Is there any feature in PL/SQL to decrease the entries in insert statement and make the insert statement along with the program small and increase the program performance.
Edited by: 983040 on Jan 20, 2013 11:11 PMBasic example (ran on 11.2.0.3):
SQL> create table testtab( id number, day date, val varchar2(30) );
Table created.
SQL>
SQL> create or replace package TestTabLib as
2
3 type TTestTab is table of testtab%rowtype;
4
5 procedure InsertRows( rowArray TTestTab );
6
7 end;
8 /
Package created.
SQL>
SQL> create or replace package body TestTabLib as
2
3 procedure InsertRows( rowArray TTestTab ) is
4 begin
5 forall i in 1..rowArray.Count
6 insert into testtab values rowArray(i);
7 end;
8
9 end;
10 /
Package body created.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a bulk fetch as
5 --// an example
6 select
7 object_id, created, object_name
8 bulk collect into
9 rowArray
10 from all_objects
11 where rownum < 11;
12
13 --// bulk insert array
14 TestTabLib.InsertRows( rowArray );
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab;
ID DAY VAL
100 2011/12/05 09:16:03 ORA$BASE
116 2011/12/05 09:16:04 DUAL
117 2011/12/05 09:16:04 DUAL
280 2011/12/05 09:19:09 MAP_OBJECT
365 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
367 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
368 2011/12/05 09:19:10 TABLE_PRIVILEGE_MAP
370 2011/12/05 09:19:11 TABLE_PRIVILEGE_MAP
371 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
373 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
10 rows selected.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a custom build
5 --// loop example such as a Java front-end will
6 --// use reading data from user input form
7 rowArray := new TestTabLib.TTestTab();
8 rowArray.Extend(2); --// user entered 2 values
9 for i in 1..rowArray.Count loop
10 rowArray(i).id := i;
11 rowArray(i).day := trunc(sysdate);
12 rowArray(i).val := 'value '||to_char(i,'000');
13 end loop;
14
15 --// bulk insert array
16 TestTabLib.InsertRows( rowArray );
17 end;
18 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab where val like 'value%';
ID DAY VAL
1 2013/01/21 00:00:00 value 001
2 2013/01/21 00:00:00 value 002
SQL> -
Adding data from an array to a table
How can i add information from an array to a table via JDBC? I have tried:
stmt.executeUpdate("INSERT INTO TEMP " + "VALUES (" + carData[0] + ", " + carData[1]);
but i get the error:
SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Also, can i only add data to some columns of a row and not all?If your TEMP table has only two columns and both of
them are of number
types, and your array contains only numeric types
(int[], long[] etc., it should not be a problem.
If your table contains more than two columns (and the
remaining columns are nullable) you need to list the
column names in the insert statement. Check your table
definition in the database and see SQL syntax for
insert.
If your columns are of string type, you need to
enclose the values in quotes (alternatively, use
PreparedStatement).I agree with this.
Here is the syntax that he was talking about
//if the values are numeric
stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
+ "VALUES(" + carData[0] + "," + carData[1] + ")";
//if the values are text
stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
+ "VALUES('" + carData[0] + "','" + carData[1] + "')";
Notice that the last part of your original query was incorrect. You forgot to put the bracket in quotes again. -
Comparing data from two tables
My PL/SQL is very limited, however, I need to write some code that compares data stored in two different Oracle tables and then writes the differences to a third table. Both tables have primary keys that I will use to ensure I am comparing like for like. These tables could be large.
Any help on the best way to do this, or any code examples would be very appreciated.One fairly efficient way of doing this is with set operators. The following code is untested - but looks right ;). It also assumes you want to know the provenance of the rows; if not, just zap the literal from each SELECT statement.
INSERT INTO diff_tab SELECT * FROM
( (SELECT 'tab1nottab2' AS provenance, t1.col1, t1.col2 FROM tab1 t1
MINUS
SELECT 'tab1nottab2', t2.col_a, t2.col_b FROM tab2 t2)
UNION ALL
(SELECT 'tab2nottab1', t2.col_a, t2.col_b FROM tab2 t2
MINUS
SELECT 'tab2nottab1', t1.col1, t1.col2 FROM tab1 t1)
/Cheers, APC -
Explorer failed to collect data from SE6920 array
Hi,
Any kind soul out there can provide advice how can I collect data from SE6920 using the explorer command ?
The man page of explorer says that to collect data from SE6920 aray, an input file "se6920inout.txt" with login info
must be exist under the /etc/opt/SUNWexplo directory of the server connected to th array.
However, the data collection failed while trying to retrieved from the array. The error as follow :
Gathering data for SE6920 machine at 10.12.22.39...
Nov 18 09:24:12 sslab-79[25355] se6920: ERROR Data collection for 10.12.22.39 failed because the /tmp directory is either 100 percent full,
patch 114591-22 or higher is not installed on the SP, or fix for BugID 6448763 has not yet been implemented.
Thanks very much reading this message.If all of the files are in the same folder you can use List Folder to list all of the files based on a pattern. You can then use this to auto-index a for loop.
-
How compare data from 2 different ODS and then load data to Cube
Hello, everybody,
I have 2 ODS ZINFO_1 and ZINFO_2. These ODS contain data:
ZINFO_1
document number; item number; amount
10004;1;200
10004;3;330
10004;4;650
10005;1;110
ZINFO_2
document number; item number; amount
10004;1;700
10004;4;430
After comparison ODS ZINFO_1 with ZINFO_2, into InfoCube ZICINFO_3 I have get data from ODS ZINFO_1 that document number and item number is not equal to ZINFO_2 ODSs document number and item number.
Data in InfoCube ZICINFO_3 should be:
ZICINFO_3
document number; item number; amount
10004;3;330
10005;1;110
Could you give me suggestions how do this?
Thanks in advance.
Best Regards,
Arunas StonysMost of the time you write a routine in the update rule and you want to read a table or ODS to look up for that particular field you are intersted in, if you are doing reading the table or DSO in the update rule, it will execute for each and every record, but you do reading the table in the start routine which will get executed for each data package and in your update rule, you read the internal table to put your logic.
The Start rouline can be as follows
Please do modify this routline for ur requirement
Another situation where I am loading DATA from DSO 1 to DSO 2 and looking for Records from DSO3 and DSO4.
DSO1---->DSO2(looking up data from DSO3 and DSO4 to update to DSO2).
NOw in the start routine I define 2 internal tables for DSO3 and DSO4 having sturctures like DSO3 and DSO4(with only useful fields and key fields,becoz u may not need all the fields from dSO3 and DSO4 afterall)
Now I am loading data in those interanal tables by using SELECT Query in START routine.
Now In various transformatino rule for populating different target fields I am reading those internal tables(itab_dso3 and itab_dso4) putting the read and where condition like
Code for field Z(of DSO2)
Read fieldX fieldY fields Z from itab_dso3 into wa_dso3 with key fieldsX=source_fields-fieldsx fieldY=source_fields-fieldsy.
if sy-subrc eq 0.
result = wa_dso3-fieldz
endif.
(here i am reading the itab loaded in start routine and reading it with the help of two source fields(dso1 fields fieldX and fieldY ) and comparing them with DSO3 .If there is a match then I am udpating fieldz of DSO2 with fieldZ from DSO3.)
Please do assign points if it is needful.
Thanks in advance.
Best WIshes,
VVenkat. -
Compare date from snapshot tables
I have mothly snapshot tables in oracle database 10gR2 that I loaded in discoverer 10gR2 as it as business users want to query monthly data. Fine.
Now business users want to compare two months data something like:
'snap_date jan-2009' 'site_id for jan-2009' 'site_status for jan-2009' 'snap_date feb-2009' 'site_id for feb-2009' 'site_status for feb-2009'
01/31/2009 a0001P active 02/28/2009 a0001P inactive
01/31/2009 b0001P active 02/28/2009 deleted -
01/31/2009 c0001L active 02/28/2009 c0001L active
01/31/2009 - - 02/28/2009 z0001P active
They want to see it like:
'site_id' 'site_status for jan-2009' 'site_status for feb-2009'
a0001P active inactive
b0001P active site deleted
c0001L active active
z0001P no site found active
Please suggest, how can I achieve this in discoverer?
Two snap_dates can be any dates from last five years on which already snap_shot has been taken and added to the snapshot table.
Thanks.
Edited by: vkumar on Mar 17, 2009 2:17 PMHi Rod,
Actually this is just one table having snapshot data for different months like:
'snap_date' 'site_id' 'site_status'
01/31/2009 a0001P active
01/31/2009 b0001P active
01/31/2009 c0001L active
02/28/2009 a0001P inactive
02/28/2009 c0001L active
02/28/2009 z0001P active
From this table I want to compare data for different dates with respect to site_id?
Thanks.
Edited by: vkumar on Mar 19, 2009 10:44 AM
Edited by: vkumar on Mar 19, 2009 10:44 AM -
Hi.
Im trying to compare a date from oracle to see if it's more than 24 hours old or not. If I get the date with
rs.getDate(meta.getColumnName(4));
My result is : 2007-05-23
If i use
rs.getString(meta.getColumnName(4));
My result is: 2007-05-23 10:21:12.0
How can i try
if(rs.getDate(meta.getColumnName(4)) is lesser than 24 hours)
You know what i meen :)
Sincerly
RothstenWell here is a simple code snippet which might help you....
long timedifference = rs.getDate(column_name2).getTime() - rs.getDate(column_name1).getTime();
// day = 24 hrs , 1hr = 3600 sec,1 sec = 1000 milli sec
long millisec_per_day = 24*3600*1000;
if( timedifference > millisec_per_day)
System.out.println("More than a day");
else if( timedifference < millisec_per_day)
System.out.println("Less than a day");
else if( timedifference == millisec_per_day)
System.out.println("Exactly a day");
NOTE: The following snippet may not be a perfect solution when it comes to implementation part (as many ppl do it with Calendar and others).
Hope this might help :)
REGARDS,
RaHuL
Maybe you are looking for
-
I had an issue with my Dell laptop and everytime i had opened Photoshop it would freeze and crash my computer. I had to recover my computer almost a month, and now when I try to redownload photoshop and creative cloud it tells me the same error messa
-
Ipod updater not finding proper ipod
Hey guys I have been trying to update my iPod video (5thGen) with the 2006-06-28 updater but everytime i plug in the ipod it shows it as being a 2nd generation ipod. The update and restore buttons are not available for me to click. The update buttons
-
What does the number in my dock icon mean?
I thought it meant, for example, three posts not uploaded, but that's not it. Anyone have the same thing? Here's the icon (might download instead of just appearing in Safari but I don't know how to show it without downloading it by copying the shared
-
IPhone 5 green glow at bottom of screen when 'woken up'
Got my black 16GB iPhone 5 from phones4u on the 17th November 2012. 2 weeks after I had it, I noticed a green glow appear at the bottom of the screen when I pressed one of the buttons to wake it up. This only happened when the phone had been locked f
-
[LR 4.1] Graduated filter bug
Hi, I have an image horizontally divided in two parts : 2/3 (sky) and 1/3 (ground). I have created 2 graduated filters, each fully and exactly covering one part of the image. I created the biggest one (2/3) first. The two graduated filters do not ove