Passing strong type c# object to teststand
I am fairly new in teststand and this question that I have is critical part of the project that I am working on.
First, I am using C#.NET in VS2008 and NiTestand 4.2.
What I am trying to do, passing custom object from C#.NET to the sequence.
here is my code from c#:
private void axApplicationMgr_DisplaySequenceFile(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEvent e)
SequenceFile sf = e.file;
PropertyObjectFile pof = sf.AsPropertyObjectFile();
PropertyObject po = pof.AsPropertyObject();
po.NewSubProperty("Locals.Test", NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Reference, false, "", 0);
//setting up of test station
TestStation ts = new TestStation();
ts.Name = "sample1";
po.SetValInterface("Locals.Test", 0, ts);
axSequenceFileViewMgr.SequenceFile = sf;
//learn passing data object to sequence
Inside sequence I want it to display the ts.Name, so I am sure that the value of the object is still intact.
And also, what do you suggest the handling of error of this object? what event in TestStand API.
Attached is the sequence and the .net object
Thanks in advance for your help.
Attachments:
samplesequence.zip 8 KB
Hi mdba,
It looks like you're using TestStand to call a DLL that calls into the TestStand API. If that's your objective, you can just achieve that much more simply with a Statement step in TestStand.
What is the TestStation class? Is that one that you created yourself?
What is your overall goal of this DLL? It looks like you are trying to store the Station ID in a local variable. If so, TestStand tracks this on its own and you can access it with the StationOptions.StationID property.
Mark E.
National Instruments
Schedule a Free 1-Hour online LabVIEW Tutorial with an NI Applications Engineer
Similar Messages
-
How to pass any type of objects into Portal's rules engine?
Is that possible to pass any type of objects into Portal's rules engine? Or BEA's Portal service rules engine can only allow to pass a limited number of objects?
Are there any information about BEA's rules engine? and Can we use its rules engine without using its Portal service?
Thank you.I worked on BEA rules engine 4 months back. I'm sure you can pass any JAVA object to it's working meomory. I am giving my sample rules here, hope it will be helpful for you.
I just replace pcakage name, other than that everything is from wroking project. Open in xml spy, it should be clear from the desc. If you have any questions post back.
<cr:rule-set is-complete="true" xmlns="http://www.bea.com/servers/p13n/xsd/expression/expressions/2.1.1" xmlns:cr="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1" xmlns:literal="http://www.bea.com/servers/p13n/xsd/expression/literal/1.0.1" xmlns:string="http://www.bea.com/servers/p13n/xsd/expression/string/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1 rules-core-2_1_1.xsd">
<cr:rule is-complete="true">
<cr:name>TaxForm1040</cr:name>
<cr:description>If salary is 70,000 then this rule makes 1040 as required form</cr:description>
<cr:conditions>
<multi-and>
<multi-and>
<equal-to>
<instance-method>
<variable>
<name>SalaryField</name>
<type-alias>com.blah.field.REInputObject</type-alias>
</variable>
<name>getKey</name>
</instance-method>
<literal:string>Salary</literal:string>
</equal-to>
<equal-to>
<instance-method>
<variable>
<name>SalaryField</name>
<type-alias>com.blah.field.REInputObject</type-alias>
</variable>
<name>getValue</name>
</instance-method>
<literal:integer>70000</literal:integer>
</equal-to>
</multi-and>
</multi-and>
</cr:conditions>
<cr:actions>
<new-instance>
<type-alias>com.blah.field.RequiredField</type-alias>
<arguments>
<literal:string>1040</literal:string>
</arguments>
</new-instance>
</cr:actions>
</cr:rule>
</cr:rule-set> -
How to export & import interface type data object to memory
Hi experts,
My greetings to all.
we have came across a situation where we need to pass interface type data object to memory
and import same from memory.
DATA context TYPE REF TO if_timecontext.
its not possible with regular export statement.
is their any other way to do it?
Thanks in advanced,
SudhirThank you saurabhmani & sandra.
@ saurabhmani : i tried assigning object context to memory (field-symbol) and exporting it to memory, but got runtime error.
@sandra : XML serialization & shared object concept sounds intresting but as you already checked that interface IF_TIMECONTEXT is missing the required IF_SERIALIZABLE_OBJECT interface.
Istead of exporting context data object to memory we tried different approch and it worked out for our requirement
Regards
Sudhir -
Pass container object to testStand via queue
Hello,
I try to use queue mechanism to pass container data from labVIEW to TestStand.
In TesStand I create a queue, lunch VI and waiting for incoming queue element.
In LabVIEW I try to send some data to TestStand as container (cluster).
Before this, I tried to pass numeric data and then everything was OK. Problem is only with container.
In TestStand I created custom type. Can someone help me with this issue.
Thanks in advance and best regards.
Solved!
Go to Solution.
Attachments:
ts1.JPG 113 KB
LV1.JPG 140 KBHere you are. keep in minde, that this is only "testing" version.
Attachments:
Queue_test.vi 21 KB
Queue-testowanie.seq 9 KB -
Pass these documents a object ID, application and output type..plz help
Hi frnds,
To select all the billing documents from from the document flow table i have
this peice of code----
SELECT VBELN FROM VBFA INTO CORRESPONDING FIELDS OF TABLE IT_VBFA
FOR ALL ENTRIES IN ITAB_VBAK WHERE VBELN = ITAB_VBAK-VBELN
AND VBTYP_N = 'C' OR VBTYP_N = 'G'.
i want to ---Pad two zerou2019s before the document and pass these documents a object ID,
application and output type.
Get the object ID, processing status for each billing document number and
display in the pop up window for the user.
i hope to use in NAST TABLE.
how to code this...
thnx
daniel
<LOCKED BY MODERATOR - URGENT, PLEASE HELP OR SIMILAR ARE FORBIDDEN>
Edited by: Alvaro Tejada Galindo on Aug 18, 2008 1:14 PMUse
declare the field b_vbeln of length u want adding length for 2 '0' also.
ex:- Vbeln length = 10
b_vbeln type i length 12.
b_vbeln = vbeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = b_vbeln
IMPORTING
OUTPUT = b_vbeln.
U will get b_vbeln with 2 '0' or always the value be of 12 length. -
How to access the attributes in an object using TestStand.?
hi,
I have a class named Status in C# that has 2 data members. There is another Class named Parameter and it has functions that return objects of type Status.
I made the DLL of the class Parameter. Then i added that class to NI TestStand and called a fucntion and that function is returning an object of type Status.
Is there any way by which i can access the Data Members of the returned Object in TestStand ??
Thanx in advance
Solved!
Go to Solution.Yes, there is another alternative. If you make Status a value type (i.e. a struct in C#) then you can tell teststand to store it in a corresponding TestStand data structure rather than an object reference variable. This works even for private fields in your struct. To do this:
1) First make Status a value type and make whatever other changes are necessary in your code to account for this (value types are copied when passed by value to another method, if this is not what you want you will need to pass them by reference - i.e. ref keyword in C#).
2) Recompile your assembly.
3) In the TestStand .NET module specification panel you should now see a new button next to the expression for the return value of type Status that looks like the TestStand data type icon. Push that button and it will prompt you to create a TestStand custom data type that corresponds to the .NET type. Select to save the type in MyTypes.ini type palette file. You only need to do this once. Once the type is in your MyTypes.ini type palette file it will be available from then on and you only need to update it if you change the .NET type.
4) Create a local variable of the TestStand Custom data type instead of Object Reference. Note that you can expand it and see the properties underneath.
5) Use this new local variable to store the Status return value. TestStand will copy/update the properties of the variable to correspond to those of the .NET struct that the method returns.
NOTE: You can also just store the individual fields of a struct in separate variables by expanding the return value of type Status once it's a struct and specifying a separate variable for each field rather than creating a TestStand custom data type.
Keep in mind that TestStand is making a copy when you store a struct this way so changes to the struct after this will not be reflected in the copy.
Hope this helps,
-Doug -
How to create multiple TYPES of objects from one menu?
Q: How can I create a single class to create objects of multiple 'object classes' in a way that is not a huge switch statement?
Explaination:
Let's say that I have an application that I am building, that manages five hundred object types. A properly-built object subclassing tree is created, and I want to be able to create objects of any 'leaf node' of this subclassing tree using a single 'objectCreate()' method in a 'factory object'. The purpos of this method will be to create an instance of the correct object, pass a handle to a few collections for properly sorting and storing these objects in groups.
Usually, one could create a switch in this function, testing for the type of object that the user wants to create from the menu. But in the case of having hundreds of possible object choices, this becomes harder and harder code to maintain (let alone performance).
Any suggestions?But if my menu has:
1. German Shepard
2. Doberman Pinscher
3. Malamut
4. Persian Long-hair
5. Siamese
6. Tabby
And my object class tree goes:
[ Animal ]
[ Cat ] [ Dog ]
[ various breeds ] [ various breeds ]How do I code the menu class to respond to the input, so that it runs the correct [breed] object's constructor?
The line:
Animal choice = new xxxxxxxx();
I can't use a variable to replace 'xxxxxxxx' in run-time, but having a ton of choices in code sounds/looks unreasonable.
if (choice == "Doberman Pinscher")
Animal choice = new doberman();
else if (choice == "Tabby")
Animal choice = new tabby();
Do you see what I am trying to avoid? I am not experienced enough to instantly realize how to avoid the latter, and instead, do a single instantiation command for the correct constructor. -
How to pass Array of Java objects to Callable statement
Hi ,
I need to know how can I pass an array of objects to PL/SQL stored procedure using callable statement.
So I am having and array list of some object say xyz which has two attributes string and double type.
Now I need to pass this to a PL/SQL Procedure as IN parameter.
Now I have gone through some documentation for the same and found that we can use ArrayDescriptor tp create array (java.sql.ARRAY).
And we will use a record type from SQL to map this to our array of java objects.
So my question is how this mapping of java object's two attribute will be done to the TYPE in SQL? can we also pass this array as a package Table?
Please help
ThanksI seem to remember that that is in one of Oracle's online sample programs.
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html -
Type of object from a database date/time column
Hello everyone,
I've got a concern regarding the way in which coldfusion is
treating date/time columns in a database.
In my opinion when I select a column that is let's say
timestamp type - the object in a query is CF's date/time object.
I've checked the query by getMetaData() and it looks like each
column has its own database type (eq. varchar2, date, etc).
My concern comes from a fact that I've heard that Coldfusion
is treating the date-time columns in a database as strings and in
each case it parses them. So the difference in a locale between a
database server and a Coldfusion server may result in a wrong
date/time object.
Example:
Locale of database EU: yyyy/mm/dd
Locale of Coldfusion US: yyyy/dd/mm
The date like 1st of February 2007 stored in a database would
look then in Coldfusion like: 2nd of January 2007
Could someone please confirm which version is valid?Johnny852 wrote:
> In my opinion when I select a column that is let's say
timestamp type - the
> object in a query is CF's date/time object. I've checked
the query by
> getMetaData() and it looks like each column has its own
database type (eq.
> varchar2, date, etc).
if you already know cf is returning a datetime from a
datetime in the db, what's
the question?
> My concern comes from a fact that I've heard that
Coldfusion is treating the
"fact"? unless the datetime is stored as a string, that's not
a "fact".
> Example:
> Locale of database EU: yyyy/mm/dd
> Locale of Coldfusion US: yyyy/dd/mm
btw neither of your example "locales" are in fact locales.
> The date like 1st of February 2007 stored in a database
would look then in
> Coldfusion like: 2nd of January 2007
if you pass a numeric string representation (2/1/2007 for
instance) of a date to
cf, it will be interpreted via the cf server's "default"
local (ie en_US,
month/day/year) unless you use one of the LS functions like
LSParseDateTime() &
specifically set the the locale (like setLocale("th_TH")) or
make the date
non-ambiguous (2-feb-2007) or build the date yourself from
user input using
createDate() or createDateTime(). you just need to convert
the user's string
representation to a valid cf datetime object (or i guess
force to database to
follow the user's locale date mask). -
I have 2 classes inherited from the same class.
public abstract class ParentProps {
public class OneProps extends ParentProps {
public class TwoProps extends ParentProps {
}I have another class which has a method which receive an argument of type ParentProps. How can I find out if the argument is of type OneProps or TwoProps?
public class Test {
public static void testing(ParentProps props) {
}In the above example how can I know if props object being passed is a OneProps object or a TwoProps object?srhcan wrote:
I have 2 classes inherited from the same class.
public abstract class ParentProps {
public class OneProps extends ParentProps {
public class TwoProps extends ParentProps {
}I have another class which has a method which receive an argument of type ParentProps. How can I find out if the argument is of type OneProps or TwoProps?
public class Test {
public static void testing(ParentProps props) {
}In the above example how can I know if props object being passed is a OneProps object or a TwoProps object?As said by earlier poster, It is a bad design. My question would be, why you want to make the implementing class complex? The basic feature abstract class provides is hidding the complexity and helps the implementing class looks simple. I would say rather than mentioning the Parent/abstract class name in testing method. use the implementing class name. For reference you may refer abstract factory pattern. -
Passing Array of java objects to and from oracle database-Complete Example
Hi all ,
I am posting a working example of Passing Array of java objects to and from oracle database . I have struggled a lot to get it working and since finally its working , postinmg it here so that it coudl be helpful to the rest of the folks.
First thinsg first
i) Create a Java Value Object which you want to pass .
create or replace and compile java source named Person as
import java.sql.*;
import java.io.*;
public class Person implements SQLData
private String sql_type = "PERSON_T";
public int person_id;
public String person_name;
public Person () {}
public String getSQLTypeName() throws SQLException { return sql_type; }
public void readSQL(SQLInput stream, String typeName) throws SQLException
sql_type = typeName;
person_id = stream.readInt();
person_name = stream.readString();
public void writeSQL(SQLOutput stream) throws SQLException
stream.writeInt (person_id);
stream.writeString (person_name);
ii) Once you created a Java class compile this class in sql plus. Just Copy paste and run it in SQL .
you should see a message called "Java created."
iii) Now create your object Types
CREATE TYPE person_t AS OBJECT
EXTERNAL NAME 'Person' LANGUAGE JAVA
USING SQLData (
person_id NUMBER(9) EXTERNAL NAME 'person_id',
person_name VARCHAR2(30) EXTERNAL NAME 'person_name'
iv) Now create a table of Objects
CREATE TYPE person_tab IS TABLE OF person_t;
v) Now create your procedure . Ensure that you create dummy table called "person_test" for loggiing values.
create or replace
procedure give_me_an_array( p_array in person_tab,p_arrayout out person_tab)
as
l_person_id Number;
l_person_name Varchar2(200);
l_person person_t;
l_p_arrayout person_tab;
errm Varchar2(2000);
begin
l_p_arrayout := person_tab();
for i in 1 .. p_array.count
loop
l_p_arrayout.extend;
insert into person_test values(p_array(i).person_id, 'in Record '||p_array(i).person_name);
l_person_id := p_array(i).person_id;
l_person_name := p_array(i).person_name;
l_person := person_t(null,null);
l_person.person_id := l_person_id + 5;
l_person.person_name := 'Out Record ' ||l_person_name ;
l_p_arrayout(i) := l_person;
end loop;
p_arrayout := l_p_arrayout;
l_person_id := p_arrayout.count;
for i in 1 .. p_arrayout.count
loop
insert into person_test values(l_person_id, p_arrayout(i).person_name);
end loop;
commit;
EXCEPTION WHEN OTHERS THEN
errm := SQLERRM;
insert into person_test values(-1, errm);
commit;
end;
vi) Now finally create your java class which will invoke the pl/sql procedure and get the updated value array and then display it on your screen>Alternatively you can also check the "person_test" tbale
import java.util.Date;
import java.io.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class ArrayDemo
public static void passArray() throws SQLException
Connection conn = getConnection();
ArrayDemo a = new ArrayDemo();
Person pn1 = new Person();
pn1.person_id = 1;
pn1.person_name = "SunilKumar";
Person pn2 = new Person();
pn2.person_id = 2;
pn2.person_name = "Superb";
Person pn3 = new Person();
pn3.person_id = 31;
pn3.person_name = "Outstanding";
Person[] P_arr = {pn1, pn2, pn3};
Person[] P_arr_out = new Person[3];
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor( "PERSON_TAB", conn );
ARRAY array_to_pass =
new ARRAY( descriptor, conn, P_arr);
OracleCallableStatement ps =
(OracleCallableStatement )conn.prepareCall
( "begin give_me_an_array(?,?); end;" );
ps.setARRAY( 1, array_to_pass );
ps.registerOutParameter( 2, OracleTypes.ARRAY,"PERSON_TAB" );
ps.execute();
oracle.sql.ARRAY returnArray = (oracle.sql.ARRAY)ps.getArray(2);
Object[] personDetails = (Object[]) returnArray.getArray();
Person person_record = new Person();
for (int i = 0; i < personDetails.length; i++) {
person_record = (Person)personDetails;
System.out.println( "row " + i + " = '" + person_record.person_name +"'" );
public static void main (String args[]){
try
ArrayDemo tfc = new ArrayDemo();
tfc.passArray();
catch(Exception e) {
e.printStackTrace();
public static Connection getConnection() {
try
Class.forName ("oracle.jdbc.OracleDriver");
return DriverManager.getConnection("jdbc:oracle:thin:@<<HostNanem>>:1523:VIS",
"username", "password");
catch(Exception SQLe) {
System.out.println("IN EXCEPTION BLOCK ");
return null;
and thats it. you are done.
Hope it atleast helps people to get started. Comments are appreciated. I can be reached at ([email protected]) or [email protected]
Thanks
Sunil.sHi Sunil,
I've a similar situation where I'm trying to insert Java objects in db using bulk insert. My issue is with performance for which I've created a new thread.
http://forum.java.sun.com/thread.jspa?threadID=5270260&tstart=30
I ran into your code and looked into it. You've used the Person object array and directly passing it to the oracle.sql.ARRAY constructor. Just curios if this works, cos my understanding is that you need to create a oracle.sql.STRUCT out of ur java object collection and pass it to the ARRAY constructor. I tried ur way but got this runtime exception.
java.sql.SQLException: Fail to convert to internal representation: JavaBulkInsertNew$Option@10bbf9e
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.oracore.OracleTypeADT.toDatum(OracleTypeADT.java:239)
at oracle.jdbc.oracore.OracleTypeADT.toDatumArray(OracleTypeADT.java:274)
at oracle.jdbc.oracore.OracleTypeUPT.toDatumArray(OracleTypeUPT.java:115)
at oracle.sql.ArrayDescriptor.toOracleArray(ArrayDescriptor.java:1314)
at oracle.sql.ARRAY.<init>(ARRAY.java:152)
at JavaBulkInsertNew.main(JavaBulkInsertNew.java:76)
Here's a code snippet I used :
Object optionVal[] = {optionArr[0]}; // optionArr[0] is an Option object which has three properties
oracle.sql.ArrayDescriptor empArrayDescriptor = oracle.sql.ArrayDescriptor.createDescriptor("TT_EMP_TEST",conn);
ARRAY empArray = new ARRAY(empArrayDescriptor,conn,optionVal);If you visit my thread, u'll see that I'm using STRUCT and then pass it to the ARRAY constructor, which works well, except for the performance issue.
I'll appreciate if you can provide some information.
Regards,
Shamik -
Using oracle.sql.STRUCT to pass in a COMPLEX OBJECT
I need to pass in a complex object (object with nested array of objects) into a oracle stored procedure.
We are using JDBC 9.2.0.1 drivers...
Note i am able to retrieve a complex object successfully using an oracle struct however i am not able to pass in the struct.
I do not want to use JPublisher as we are not using SQLJ.
I have looked through the documentation on using default structs and am getting an error when i try and create the struct...
I have created an array of objects with a sub array
and i create a struct descriptor however when i create the actual oracle struct
like
oracle.sql.Struct = new oracle.sql.Struct( structDesc,conn,complexobject)
I get a "java.sql.SQLException: Internal Error: Unable to resolve name"
Do i have to create STRUCTS for the nested object first ?
And then nest that STRUCT within the PARENT STRUCT to pass in complex objects ???
Any help would be much appreciated...
Gurinder
email [email protected]Thanks Konstantin Goryachev!
I'm using Oracle JDBC 9.2.0.3 drivers using a SQLData implementation.
Unfortunately i have something very similar to your code and i still get the following error
EXC: testPolicyRate(): java.sql.SQLException: Internal Error: Inconsistent catalog view
java.sql.SQLException: Internal Error: Inconsistent catalog view
void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
DBError.java:187
void oracle.jdbc.dbaccess.DBError.throwSqlException(int, java.lang.Object)
DBError.java:229
void oracle.sql.StructDescriptor.initMetaData1_9_0()
StructDescriptor.java:897
void oracle.sql.StructDescriptor.initMetaData1()
StructDescriptor.java:864
boolean oracle.sql.StructDescriptor.isInstantiable()
StructDescriptor.java:508
void oracle.sql.STRUCT.<init>(oracle.sql.StructDescriptor, java.sql.Connection, java.lang.Object[])
STRUCT.java:107
oracle.sql.STRUCT oracle.sql.OracleSQLOutput.getSTRUCT()
OracleSQLOutput.java:96
oracle.sql.STRUCT oracle.sql.STRUCT.toSTRUCT(java.lang.Object, oracle.jdbc.OracleConnection)
STRUCT.java:408
oracle.sql.Datum oracle.jdbc.oracore.OracleTypeADT.toDatum(java.lang.Object, oracle.jdbc.driver.OracleConnection)
OracleTypeADT.java:284
oracle.sql.Datum[] oracle.jdbc.oracore.OracleTypeADT.toDatumArray(java.lang.Object, oracle.jdbc.driver.OracleConnection, long, int)
OracleTypeADT.java:327
oracle.sql.Datum[] oracle.jdbc.oracore.OracleTypeUPT.toDatumArray(java.lang.Object, oracle.jdbc.driver.OracleConnection, long, int)
OracleTypeUPT.java:143
oracle.sql.Datum[] oracle.sql.ArrayDescriptor.toOracleArray(java.lang.Object, long, int)
ArrayDescriptor.java:771
void oracle.sql.ARRAY.<init>(oracle.sql.ArrayDescriptor, java.sql.Connection, java.lang.Object)
ARRAY.java:118
void com.tu.lib.busobject.PolicyRate.main(java.lang.String[])
PolicyRate.java:198
Process exited with exit code 0.
Here's my code
* Main Method
public static void main(String[] args)
throws SQLException, IOException
Connection conn = null;
OracleCallableStatement cstmt = null;
try {
/* Setup connection */
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@neptune:1521:tu_test", "OPS$WWW", "welcome1");
conn.setAutoCommit(false);
System.out.println("conn is open = " + !conn.isClosed());
/* Setup map */
System.out.println("Creating type maps...");
java.util.Map typeMap = conn.getTypeMap();
typeMap.put(_SQL_NAME,PolicyRate.class);
typeMap.put(CoverageRate._SQL_NAME, CoverageRate.class);
typeMap.put(CoverageRate._SQL_ARRAY_NAME,CoverageRate[].class);
conn.setTypeMap(typeMap);
/* Create a coverage rate object to be inserted into array of policy rate object */
CoverageRate covrObj = new CoverageRate(1,
"HMS",
30,
5,
new BigDecimal(0),
null,
null,
new BigDecimal(0),
new BigDecimal(0),
0,
0);
/* Create an array */
System.out.println("Creating descriptor...");
ArrayDescriptor adesc = new ArrayDescriptor(CoverageRate._SQL_ARRAY_NAME,conn);
System.out.println("Created descriptor!");
Object [] covrArray = new Object[1];
covrArray[0] = covrObj;
System.out.println("Creating oracle array..");
ARRAY arr = new ARRAY(adesc,conn,covrArray);
System.out.println("Created array!!");
/* Create policy rate object */
PolicyRate prate = new PolicyRate ("TESTTRA",
"TRS",
TUDate.convertToSql("2003","08","27"),
TUDate.convertToSql("2004","06","25"),
TUDate.convertToSql("2004","06","29"),
"NEW",
1,
new BigDecimal(0),
new BigDecimal(0),
null);
/* Add coverage rate object to array -- assume array only has one element for timebeing */
System.out.println("Setting arr in policyrate...");
prate.setRates(arr);
System.out.println("Creating array.sql.ARRAY for covrObj..");
prate.setRates(new oracle.sql.ARRAY(adesc,conn,covrObj));
System.out.println("Created array.sql.ARRAY for covrObj..");
/* Setup statemenet object */
cstmt = (OracleCallableStatement) conn.prepareCall("{call dbpckg_rate_obj.p_rate_obj_calc_rate(?)}");
/* Bind variables to statement */
System.out.println("Setting policyrate object...");
cstmt.setObject(1,prate,OracleTypes.STRUCT);
System.out.println("Registering out object...");
cstmt.registerOutParameter(1,oracle.jdbc.OracleTypes.STRUCT,PolicyRate._SQL_NAME);
cstmt.execute();
/* Retrieve the object back */
System.out.println("Getting policy rate object back...");
prate = (PolicyRate) cstmt.getObject(1);
System.out.println("Object Retrieved " + prate.getProductcode() + " " + prate.getAgentcode());
/* Close database connection */
conn.close();
catch (Exception exc) {
System.out.println("EXC: testPolicyRate(): " + exc);
exc.printStackTrace();
if (conn != null)
conn.close();
finally {
if (conn != null)
conn.close();
I've opened up a tar through metalink hopefully they can help get past this error...:)
Gurinder -
Passing an array of objects to stored procedure(oracle)
I have to pass an array of objects to a pl/sql stored proc.
Its prototype is,
proc_orderins(ordernum varchar2(14), ct newTask)
where newTask is an array of objects:
type task as object ( name varchar2(20),odd varchar2(8),sdd varchar2(8));
create or replace type newTask as VARRAY(25) OF Task;
will the following work from the java code :
public class CriticalTask
String name,odd,sdd;
public CrticalTask(String name,String odd,String sdd)
this.name=name;
this.odd=odd;
this.sdd=sdd;
Object [] ctasks =new Object[7];
for(i=0;i<7;i++)
Object=new CrtitcalTask("x","x","x");
String query="{call proc_orderins(?,?)}";
CallableStatement cstmt=con.prepareCall(query);
cstmt.setInt(123);
cstmt.setObject(ctasks);
cstmt.execute();
will the above code work, when I am passing an array?Use code tags when you post code.
I am rather certain that the code you posted will not work.
Technically you should be able to use the java.sql.Array interface.
The newest Oracle drivers might support that (you would have to investigate how to use it.)
It is however possible that it isn't supported. If not then you will have to use one of the Oracle specific classes that is documented in the Oracle jdbc documentation. -
Hi All,
following piece of code was working fine in 4.6 C but in ECC 6.0 I get the following error:
" "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) . "
I tried type-casting with field symbols but still not able to remove the error. Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
In the following code :
DATA: DELIMITER TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
end_of_record TYPE x.
SPLIT data_file_i AT delimiter INTO it_ekko-rtype
it_ekko-ebeln
it_ekko-bsart
it_ekko-lifnr
it_ekko-bedat
it_ekko-ekorg
it_ekko-ekgrp
it_ekko-bukrs
it_ekko-zterm
it_ekko-zbd1t
it_ekko-zbd1p
it_ekko-zbd2t
it_ekko-zbd2p
it_ekko-zbd3t
it_ekko-inco1
it_ekko-inco2
it_ekko-waers
it_ekko-wkurs
it_ekko-kufix
it_ekko-verkf
it_ekko-telf1
it_ekko-ihrez
it_ekko-unsez
it_ekko-angnr
it_ekko-ihran
it_ekko-submi
it_ekko-loekz
end_of_record.
where all these fields except " end_of_record " are of character type and "data_file_i " is a character type structure as defined below:
DATA :
BEGIN OF data_file_i OCCURS 0,
record(1000),
END OF data_file_i,Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
Is it possible to pass some type of parameter/unique id FROM PDF?
hi there,
I will try to explain this as best as I can but please bear with me.
I have Adobe Acrobat X Pro.
We have drawings linked to each other in pdf.
When you open a drawing (say, a layout of a house), my boss wants to be able to click on say, a door, and have all the information on that door pop up (size, manufacturer, when it was shipped, etc). The information log is stored in Excel. I know how to hyperlink to open an excel file FROM pdf, but cannot figure out how to open a specific sheet in Excel. So here is my question:
1. How do I link to a specific sheet in Excel so it opens when I click on a link in the pdf file?
Having said that, we are going to have around 1500 items and I don't want to have to create 1500 sheets (if that's even possible) to open the details for each one. So here is question #2:
2. Is it possible to pass some type of parameter to excel (or even Access) to know what item was clicked on the pdf file so I can write a macro/code in Excel to just fill in the details for that item? (Hence just needing one sheet instead of 1500?).
Suggestions/path forwards are welcome.
I hope this was clear and I thank you in advance.
Thanks,
JessicaThere really isn't a way to do that. It would be possible to export an Excel sheet to a tab-delimited (or CSV, XML) file which could optionally be attached to the PDF. JavaScript inside the PDF could read the data file and extract the information for an item so it could be displayed somehow.
Maybe you are looking for
-
My iPhone 5c has a broken screen and won't let me swipe. I got a new iPhone 5c, but want my stuff to back up onto it. I haven't backed up my old one in over a year because there's not enough storage. How would I back up on iCloud to a Dell or Toshiba
-
Hi, I would to create a chart that looks like a pie chart, in the form of a clock. I am struggling to come up with a good way to do this. The clock represents 24 hours. Each element (slice of the pie) within the chart represents a scheduled event, f
-
Hi All, I need to strike a word in abap... For ex : daughter It should come as daughter Thanks,
-
NCO3 Error: cannot find STRUCTURE specified by LEDID_IDOC_TYPE
Hi all, I am trying to get an IDoc defininition by IDOC_TYPE_COMPLETE_READ. When I create the function with: IRfcFunction rfcFunction = destination.Repository.CreateFunction("IDOC_TYPE_COMPLETE_READ"); there is an Exception thrown: SAP.Middleware.Con
-
Java.rmi.RemoteException: Unexpected fault was returned by the server
Hi, when we try to have some concurrent request, we've got the following error : java.rmi.RemoteException: Unexpected fault was returned by the server (faultcode: Server.userException, faultstring: java.net.SocketTimeoutException: Read timed out). at