How to handle a second array?
Hi all,
I tried to add in a second array, but I got an error that said "unreachable code" for each aspect I entered using array b(the second array).
// IntegerSet.java
public class IntegerSet {
private int [] a; // holds a set of numbers from 0 - 100
private int [] b; // also holds numbers 0 - 100
public IntegerSet () {
// an empty set, all a[i] are set to 0
a = new int [101];
b = new int [101];
// A constructor that copies from an existing set.
public IntegerSet (IntegerSet existingSet) {
a = new int [101];
b = new int [101];
for(int i=0; i<a.length; i++)
a[i] = existingSet.a;
for(int i=0; i <b.length; i++)
b[i] = existingSet.b[i];
public void deleteElement(int i) {
if ((i >= 0) && (i < a.length))
a[i] = 0; // set to 1
if ((i >= 0) && (i < b.length))
b[i] = 0;
public void insertElement(int i) {
if ((i >= 0) && (i < a.length))
a[i] = 1; // set to 1
if ((i >= 0) && (i < b.length))
b[i] = 1; // set to 1
public boolean isSet(int i) {
return (a[i] == 1);
return (b[i] == 1);
// The union of this set and another set
public IntegerSet unionOfIntegerSets(IntegerSet otherSet) {
IntegerSet newSet = new IntegerSet(this);
// newSet is now a copy of the current set. Next we want to union with set a
for(int i=0; i<a.length; i++) {
if (otherSet.isSet(i))
newSet.insertElement(i);
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i))
newSet.insertElement(i);
return newSet;
// The intersection of this set and another set
public IntegerSet intersectionOfIntegerSets(IntegerSet otherSet) {
IntegerSet newSet = new IntegerSet(this);
// newSet is now a copy of the current set. Next we want to intersect with set a
for(int i=0; i<a.length; i++) {
if (!otherSet.isSet(i))
newSet.deleteElement(i);
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i))
newSet.deleteElement(i);
return newSet;
// return true if the set has no elements
public boolean isEmpty() {
for (int i=0; i<a.length; i++)
if (isSet(i)) return false;
return true;
for (int i=0; i<b.length; i++)
if (isSet(i)) return false;
return true;
// return the 'length' of a set
public int returnLength() {
int count = 0;
for (int i=0; i<a.length; i++)
if (isSet(i))
count++;
for (int i=0; i<b.length; i++)
if (isSet(i))
count++;
return count;
// Print a set to System.out
public void setPrint() {
System.out.print("[Set:");
if (isEmpty())
System.out.print("---");
for (int i=0; i<a.length; i++) {
if (isSet(i))
System.out.print(" " + i);
for (int i=0; i<b.length; i++) {
if (isSet(i))
System.out.print(" " + i);
System.out.print("]\n");
// return true if two sets are equal
public boolean isEqualTo(IntegerSet otherSet) {
for(int i=0; i<a.length; i++) {
if (otherSet.isSet(i) != isSet(i))
return false;
return true;
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i) != isSet(i))
return false;
return true;
// Small test program to verify that IntegerSet works!
public static void main (String [] args) {
IntegerSet smallEvens = new IntegerSet();
IntegerSet smallOdds = new IntegerSet();
for (int i=0; i < 101; i++)
if ((i % 2) == 0)
smallEvens.insertElement(i);
else
smallOdds.insertElement(i);
System.out.print("smallEvens: ");
smallEvens.setPrint();
System.out.print("smallOdds: ");
smallOdds.setPrint();
IntegerSet union = smallEvens.unionOfIntegerSets(smallOdds);
System.out.print("union: ");
union.setPrint();
IntegerSet intersection = smallEvens.intersectionOfIntegerSets(smallOdds);
System.out.print("intersection: ");
intersection.setPrint();
// Output:
// smallEvens: [Set: 0 2 4 6 8]
// smallOdds: [Set: 1 3 5 7 9]
// union: [Set: 0 1 2 3 4 5 6 7 8 9]
// intersection: [Set:---]
I'm guessing I probably put the braces wrong or something. Any ideas on how to fix this? I appreciate any help given. Thanks.
All right, I edited part of the code, and put in comments to where the error occurs.
public class IntegerSet {
private int [] a; // holds a set of numbers from 0 - 100
private int [] b; // also holds numbers 0 - 100
public IntegerSet () {
// an empty set, all a[i] are set to 0
a = new int [101];
b = new int [101];
// A constructor that copies from an existing set.
public IntegerSet (IntegerSet existingSet) {
a = new int [101];
b = new int [101];
for(int i=0; i<a.length; i++)
a[i] = existingSet.a;
for(int i=0; i <b.length; i++)
b[i] = existingSet.b[i];
public void deleteElement(int i) {
if ((i >= 0) && (i < a.length))
a[i] = 0; // set to 1
if ((i >= 0) && (i < b.length))
b[i] = 0;
public void insertElement(int i) {
if ((i >= 0) && (i < a.length))
a[i] = 1; // set to 1
if ((i >= 0) && (i < b.length))
b[i] = 1; // set to 1
public boolean isSet(int i) {
return (a[i] == 1 && b[i] == 1);
// The union of this set and another set
public IntegerSet unionOfIntegerSets(IntegerSet otherSet) {
IntegerSet newSet = new IntegerSet(this);
// newSet is now a copy of the current set. Next we want to union with set a
for(int i=0; i<a.length; i++) {
if (otherSet.isSet(i))
newSet.insertElement(i);
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i))
newSet.insertElement(i);
return newSet;
// The intersection of this set and another set
public IntegerSet intersectionOfIntegerSets(IntegerSet otherSet) {
IntegerSet newSet = new IntegerSet(this);
// newSet is now a copy of the current set. Next we want to intersect with set a
for(int i=0; i<a.length; i++) {
if (!otherSet.isSet(i))
newSet.deleteElement(i);
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i))
newSet.deleteElement(i);
return newSet;
// return true if the set has no elements
public boolean isEmpty() {
for (int i=0; i<a.length; i++)
if (isSet(i)) return false;
return true;
for (int i=0; i<b.length; i++) // unreachable statement
if (isSet(i)) return false;
return true;
// return the 'length' of a set
public int returnLength() {
int count = 0;
for (int i=0; i<a.length; i++)
if (isSet(i))
count++;
for (int i=0; i<b.length; i++) // unreachable statement
if (isSet(i))
count++;
return count;
// Print a set to System.out
public void setPrint() {
System.out.print("[Set:");
if (isEmpty())
System.out.print("---");
for (int i=0; i<a.length; i++) {
if (isSet(i))
System.out.print(" " + i);
for (int i=0; i<b.length; i++) {
if (isSet(i))
System.out.print(" " + i);
System.out.print("]\n");
// return true if two sets are equal
public boolean isEqualTo(IntegerSet otherSet) {
for(int i=0; i<a.length; i++) {
if (otherSet.isSet(i) != isSet(i))
return false;
return true;
for(int i=0; i<b.length; i++) {
if (otherSet.isSet(i) != isSet(i))
return false;
return true;
// Small test program to verify that IntegerSet works!
public static void main (String [] args) {
IntegerSet smallEvens = new IntegerSet();
IntegerSet smallOdds = new IntegerSet();
for (int i=0; i < 101; i++)
if ((i % 2) == 0)
smallEvens.insertElement(i);
else
smallOdds.insertElement(i);
System.out.print("smallEvens: ");
smallEvens.setPrint();
System.out.print("smallOdds: ");
smallOdds.setPrint();
IntegerSet union = smallEvens.unionOfIntegerSets(smallOdds);
System.out.print("union: ");
union.setPrint();
IntegerSet intersection = smallEvens.intersectionOfIntegerSets(smallOdds);
System.out.print("intersection: ");
intersection.setPrint();
// Output:
// smallEvens: [Set: 0 2 4 6 8]
// smallOdds: [Set: 1 3 5 7 9]
// union: [Set: 0 1 2 3 4 5 6 7 8 9]
// intersection: [Set:---]
Similar Messages
-
How to load a second array?
I have this code loading a set of thumbnails. Right now the
first set of thumbs loads fine but how to load my second array in a
new row?Well my first idea would be that somewhere you are out of
scope and therefore you are getting an undefined somewhere in your
code.
So it might be trying to pass "undefined" as your url.
I would start with the debugger and step through the code to
make sure that it is able to get all the values it needs at every
step.
A good understanding of the debugger tool will save you tons
of time.
My next idea would be to split the code up using the command
pattern.
Also, since you only have two arrays, you could put an if
statement before incrementing the arr variable.
example:
if (arr < 2){
arr++;
} -
How to handle ever expanding array?
Hi,
I'm looking for help with a temperature control experiment...
I have a program to aquire data from 24 channels through a while loop.
I am displaying the data in a waveform graph. Currently, I am using
shift registers and build array to add new data to the graph every time
through. This worked fine while I was prototyping the hardware, but now
I'd like it to run for days on end; as everyone can imagine, the array
keeps getting bigger and the build array function keeps hogging memory
until the whole thing crashes.
I'm guessing that I should be writing the data to a file every so
often, which would keep the size manageable, and would allow me to know
the size of the array and could use other opperations rather than build
array. The array would need to stay pretty small so the write operation
didn't slow down the loop too much. The program is pretty slow, since
I'm limited in how quickly I can
change temperatures. Currently, I go through all 24 probes about every
2.5 seconds (this is set just by how long it takes the routine to read
each temperature and calculate the control parameters). If it takes a
little bit longer each time through, that's not a huge problem, but a
big pause every so often would make the control routine behave oddly.
What the save-to-file option takes away, however, is the ability to
walk up to the machine in the morning and see at a glance how well it
regulated the temperature during the night. I've thought about keeping
some reduced set of the data (every minute or so) to give me a
low-frequency glance at the data, but it seems like this will simply
postpone the inevitable memory loading. I don't know if I could have a
separate program that opened up the files that the control routine
wrote, but this would probably be too much for the poor old PII machine
that is running this.
Does anyone have a simple solution to this probelm? Failing that, a
complex solution might do, although it might get beyond my programming
abilities.
I only have LV 6.0, so I can't see examples saved for versions later than this.
Thanks for any suggestions.
cheers,
mikeMike,
Writing data to an array every so often is definitely what you want to do. Then if power fails or the program shuts down for some reason, the data to the last save is still in the file. At the 2.5 second sample rate you only get ~35000 points per channel per day, so data files will not get too large. Decide how often to write by how valuable the data is: What is the penalty for losing data for the last minute, hour, day...?
Another point is that the panel display only occupies a few hundred pixels in each direction. Plotting more points than that is meaningless. If you plot one point per minute you will have 1440 points per day (per channel). You could always show the most recent 24 hours using a circular buffer. With more programming effort, you could keep previous days plots available for selection by the user or read them back from the file.
Lynn -
How to handle massive array operations
Hi!,
We are working with large arrays of the order of 5000 x 100000 (rows x col).
We wish to perform typical array operations like replace subset, indexing, rotating and addition.
Our questions:
1) How do we work with this array within the same VI without creating indicators or controls. Wiring, we understand, is an option but then the wires will clutter our screen.
2) How do we pass/retrieve this array data to/from sub-VIs without creating indicators or controls.
3) What the fastest recommended methods of handling such large arrays.
4) Our array will be either Boolean or U8. Will both data types give similar speed results?
5) When using the replace subset function, can the subset be same dimension as original array?
6) Can we rotate a particular row within a 2D array? As of now, we extract the row as 1D, rotate and then replace the original row with rotated row.
Any ideas/suggestions (specific to array handling) to help speed our VI will be highly appreciated.
We are using LV 7.1 on Win2000
Thanks,
Gurdas
Gurdas Singh
PhD. Candidate | Civil Engineering | NCSU.eduSaverio, Joe, Jason and Benoit - Thanks!
Reply to Saverio's inputs:
(1) Not sure what you mean by this. If you need to work with that data in the same VI you use wires - that's the most efficient way of doing it. Are you thinking about local variables or something?
No, we avoid locals like birdflu! What I meant was how do I carry data from one part of my block diagram (BD) to another without using wires (because wires clutter the block diagram)? Is there no variable/container which will hold data without it being a control/indicator? Some of my front panels will be displayed. In such VIs, the moment I use a control/indicator in the BD to "hold" my data, my speeds drop.
(2) OK
(3) OK
(4) LabVIEW stores Booleans as 8-bit data. You should choose the one that makes more sense for your application.
U16 makes most sense.
U8 also does the task, only catch is at the end I need to convert the array into U16 for the last operation to happen (all elements in a col are added; thus final array is 1D row array).
I would use Boolean ONLY if it gives significant speed gains over U8 (I will need to convert Boolean to U16 at the end).
Any inputs/ideas?
(5) OK
(6) You will need to be a little more specifc about this one, though I suspect the Transpose 2D Array function coupled with the Replace Array Subset is what you're looking for.
Lets say the first row of my 2D array has 5 elements, which are 3 6 12 8 1. I want this to become 12 8 1 3 6. In effect I left rotated my first row my two positions.
Rgds,
Gurdas
Gurdas Singh
PhD. Candidate | Civil Engineering | NCSU.edu -
If i load 1GB file in labview array, it shows memory full. How tom handle it?
if i load 1GB file in labview array, it shows memory full. How tom handle it?
Don't read it all at once. Just read the parts you need when you need it.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
How can I build an array not knowing final size at startup?
Hi,
I need to be able to build an array with a certain number of rows but that number is not known at runtime. Instead it can't exceed 5 in a certain time period. So my question is: every 20 seconds I need to send out the 5 row array but if lets say 10 rows of data come in in 20 seconds I am not sure how to handle the data to have it build 2 arrays and send them out one after another at the elapse of the 20 seconds as opposed to just sending an array with 10 rows and losing half the data on the receiving side. Please any help will be appreciated,
AlexI understand that you have to send a least a message every 20 seconds (could be empty ?), but can you send more messages if you get more data (e.g. 3 message of 5 rows in 20 sec) ?
If you can, then all you have to do is to trigger the sending of a message each time the array size reaches 5, or if 20s ellapsed since last sent message.
Here is an example, using shift registers. there is a random data generation so that you can see it working (if you set the time between data long enough, then you will see the data sent after 20 sec. Well not exactly 20 sec, but i guess you can figure this out later by yourself...)
I hope this will be of any help
Attachments:
dynamic_array.vi 36 KB -
How to handle null values in RTF templates
Hi - I have two groups in a report for different SQL and two formulas for each group, CF_ELE_CNT and CF_ELE_CNT1. In the template I use the below code to print or not print a section.
<?if:number(CF_ELE_CNT +CF_ELE_CNT1) >0?>
The problem is when there is no data in the second group its not creating the XML tag for CF_ELE_CNT1, though CF_ELE_CNT has 13, it still does not print that partucular section. If I remove CF_ELE_CNT1 from the condition it works fine. I was wondering how to handle this.
Any help would be appreciated!!
Thanks,
RavHey Rav,
You can add a check to identify it the element/tag is present or not
<?if:(CF_ELE_CNT1)?> will give true, if the element is present otherwise falsesince you are adding the two elements, you have to add a or condition.
<?if:(CF_ELE_CNT and number(CF_ELE_CNT) >0 ) or ( CF_ELE_CNT1 and CF_ELE_CNT1 >0)?> -
How to handle password changes if we implement singlesignon between BO& BI7
Hi,
As we know ,we can implement single signon between BO and SAP BI 7, by importing roles and users through CMC and by selecting the option "Use Single signon during report refresh time".
My doubt here is, When we import roles from SAP and Auto import the users, is it only the SAP usernames that are stored in BO repository or both username and password. If second case holds true then how to handle/manage password change for a user who is already imported in BO sometime back?
Would the password changes be reflected automatically in BO?
Please guide me if you think that I'm thinking in a wrong direction.Hi Naresh,
password changes are reflected automatically in BO. BO just forwards the data to the SAP side and it does the real authentification.
Regards,
Stratos
PS: Keep in mind that you cannot change the SAP password on the BO login screen if your SAP password has expired. You have to do this with the SAP client (SAP GUI) -
How to handle multiple records in BPMN process
Hi All,
We are using Oracle BPM 11g.In my requirement,I am using the database adapter to get the data from table and I need to validate the each record and update the status of that record from the BPM Process.But I dont know how to handle if multiple records come at a time.Can anybody please helpout from this problem.
Thanks in advanced.
Narasimha Rao.Can you have a look at this post: http://redstack.wordpress.com/2010/09/30/iteratingtraversing-arrays-in-bpm/
It's solving a different problem, but the key is that it's using a multi-instance subprocess to iterate over an array of "things" that need to be acted in. In your case it's the set of results from the db query rather than the set of tests in the example. But the principle is the same. You'd take collection of rows from the DB and process them in a multi-instance subprocess. The text that begins with the following would be good place to start:
"Now let’s implement the body of our process. We will use the Subprocess object to handle the traversal of the array of tests. Drag a Subprocess from the component palette on the right into the process and drop it on the line between the Start and End nodes."
In the loop characteristics you'd define whether you want to execute serially or in parallel. -
How to share structure with arrays in a single file between C# and C with arrays?
It is possible to define things so that a file that contains a struct definition can be included in both C# and C programs once the differences are taken into account. Most of these differences can be handled but not all. One of those problems is arrays.
Here's a contrived example of a file that can be imported directly into either a C or a C# project. If '__c__' is defined then the file is being imported into a C++ project. If not then the file is being consumed by a C# project. This simple little
thing allows those things that are different between the two environments to be taken into consideration. The one really knotty problem is how to handle arrays. In C, an array can be given a fixed size in a struct. Not so in C#. C# generates a compile time
error. I've been working around it so far by numbering the elements in the C# branch.
// If '__c__' is defined then the file is being included in a C project.
// If not then the file is being included in a C# project.
#if !__c__
// C# can utilize a namespace. C cannot.
namespace CrossPlatform
// C# wants to include the struct in a class.
public class Structs
#endif
#if __c__
// C defines a struct as a named typedef.
typedef struct _RtInfo
#else
// C# wants a struct object with a name.
public struct RtInfo
#endif
// Simple value types and previously defined structures
// can be shared directly between both C and C#.
float f;
#if __c__
// Arrays cannot be shared. C can use arrays with a size.
int v[4];
#else
// but C# cannot deal with sized arrays at all.
int v0;
int v1;
int v2;
int v3;
#endif
#if __c__
// C optionally gives the struct a name.
} CALDATA;
#else
// C# does not do that here.
#endif
#if !__c__
} // end of class.
} // end of namespace block wrapper.
#endif
Richard Lewis HaggardHi
Richard.
Would you mind letting us know the result of the suggestion?
I temporarily mark
Viorel’s last response as an answer. You can unmark
it if they provide no help.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to handle special characters in NWDI
Dear All
I am trying to update the Description from JSP form. Through JCO we are calling the RFC of ABAP. We are passing these description from Java to RFC of ABAP and this RFC update the text in Database.
We have noticed that if there is some special character in description like as : or , complete description is not getting updated in to the SAP database.
Can anyone help me how to handle these special characters in Java. There may be N number of special characters. We want to generalize it. We want to replace these characters by s and z respectively.
For example : We want to update this description.
APPLERR H'4301 H'FA03 H'254C na Zagreb TC4 rijeen je cleaning procedurom, te je i kroz CSR odgovoreno da trap korekcija N01TCADG-0052 u bloku UPDC vie nije potrebna, te se moe izbaciti (AP143).
Uspjeno su zavrene HR17/CN-A3 FOA-e na tranzitnom nivou, te slijedi roll-out u dva termina 12/13.04 i 19/20.04. ETK je na sastanku isporučio SW, te ALEX i mini PLEX za sve objekte.
AP147. Poslati finalnu dokumentaciju za uvođenje paketa (implementacijsku instrukciju i sve popratne datoteke).
WHile updated text is as follows :
APPLERR H'4301 H'FA03 H'254C na Zagreb TC4 rije
N01TCADG-0052 u bloku UPDC vi
Uspje
sastanku isporu
AP147. Poslati finalnu dokumentaciju za uvo
Regards
BhavishyaHi Bhavishya,
Apparently your SAP database isn't configured to support Unicode. That would be the first solution to your problem, but I can imagine it's a bit drastic to convert your DB.
A second solution would be to encode the input description to ASCII before storing it in the database. When reading from the database, decode again to Unicode. This way, no information is lost. A suitable encoding would be Base64. e.g.
String description = "unday ebra";
String descriptionBase64 = new sun.misc.BASE64Encoder().encode(
description.getBytes("UTF-8")); // ""
// store descriptionBase64 in the DB
// later, when reading descriptionBase64 from the DB
String description2 = new String(
new sun.misc.BASE64Decoder().decodeBuffer(descriptionBase64), "UTF-8");
Instead of using Sun's implementation, a better alternative is to use the open source implementation
org.apache.commons.codec.binary.Base64 from Commons Codec .
The 3rd approach is indeed to normalize the description by replacing all special characters with their ASCII equivalent. A rather easy solution is as follows:
String description = "unday ebra";
String descriptionNormalized = sun.text.Normalizer.normalize(
description, sun.text.Normalizer.DECOMP, 0).replaceAll(
"[^p{ASCII}]", "");
sun.text.Normalizer decomposes the string, e.g. "éàî" becomes "e´a`i^", after which non-ASCII characters are being removed using a regular expression.Again, note that it's usually a bad idea to use sun.* packages, see note about sun.* packages. The above code only works with J2SE 1.4 and J2SE 5.0, but it breaks in J2SE 6.0 (where
java.text.Normalizer became part of the public API ;-). A good open source implementation can be found here: ICU4J (com.ibm.icu.text.Normalizer).
Kind regards,
/Sigiswald -
How to handle Big FIles in SAP PI Sender file adapter
Hi all ,
I have developed a interface , where it is File to Proxy, it is fine when i do with small and normal files
The structure contain one Header unbounded detail and one Trailer, how to handle when the file size is more than 40 MB
Thanking you
SridharHi Sridhar Gautham,
We can set a limit on the request body message length that can be accepted by the HTTP Provider Service on the Java dispatcher. The system controls this limit by inspecting the Content-Length header of the request or monitoring the chunked request body (in case chunked encoding is applied to the message). If the value of the Content-Length header exceeds the maximum request body length, then the HTTP Provider Service will reject the request with a 413 u201CRequest Entity Too Largeu201D error response. You can limit the length of the request body using the tting MaxRequestContentLength property of the HTTP Provider Service running on the Java dispatcher. By default, the maximum permitted value is 131072 KB (or 128MB).You can configure the MaxRequestContentLength property using the Visual Administrator tool. Proceed as follows:
1. Go to the Properties tab of the HTTP Provider Service running on the dispatcher.
2. Choose MaxRequestContentLength property and enter a value in the Value field. The length is specified in KB.
3. Choose Update to add it to the list of properties.
4. To apply these changes, choose (Save Properties).
The value of the parameter MaxRequestContentLength has to be set to a high value.
The Visual administartor tool may be accessed using this link
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40a08db9-59b6-2c10-5e8f-a4b2a9aaa3d2?quicklink=index&overridelayout=true
In short ICM parameters to reset values for this case are
icm/HTTP/max_request_size_KB
icm/server_port_ TIMEOUT
rdisp/max_wprun_time
zttp/max_memreq_MB
Please look into this thread to know more about ICM parameters
http://help.sap.com/saphelp_nw04/helpdata/en/61/f5183a3bef2669e10000000a114084/frameset.htm
Second solution is that you must split the source file, so that each file is less than 5MB in size, then PI would not cause problem for file size between 1MB-5MB. you can insert header and trailer for individual smaller file obtained after split. All this can be done using scripts or conventional programing provided individual records within file are independent of each other. Finally you have to rename each new file created and put them in PI folder in sequential manner. All this can be achieved by simple shell script/batch file, a C code or java code. If you are going for a C or Java code you need a script to call them from PI communication channel parameter "run operating system command before message processing".
regards
Anupam -
How to handle multiple actions in the webservice ?
Hi Guys,
I have multiple operations in the webservcie and under soap action in the receiver soap adapter, i dont know how to handle multiple soap operations.
can anybody guide me, how to acheive this ?
Thanks,
sriniHi Srini !
This weblog shows the general design of a scenario with BPM
/people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
This link:
http://help.sap.com/saphelp_nw04/helpdata/en/de/766840bf0cbf49e10000000a1550b0/content.htm
show how to insert a predefined BPM pattern. You could use one of the BpmPatternSerialize.... patterns to see how you BPM should look like...
Basically it should be:
1) Receive Step (async/sync, as you need) to trigger the BPM
2) Send step (sync) for first webservice
3) Send step (sync) for second webservice
N) Send step (sync) for N webservice
N+1) if the whole communication is sync, here you need to use a send step to return back the answer to sender.
Regards,
Matias. -
How to handle error while using dbms_sql.execute
Hi,
I am inserting some records by using the following piece of code.
stmt := 'insert into SSI_KPI_GOAL_VALUE_H (KPI_VAL_KPI_ID, KPI_VAL_RM_CDE,'|| v_day_value ||',KPI_VAL_ACT_DLY,'||v_month_val||',KPI_VAL_BIZ_UNIT_CDE) values (:kpi_array,:rm_array,:day1_array,:day1_array,:day1_array,:busnunit_array)';
l := dbms_sql.open_cursor;
dbms_sql.parse(l, stmt, dbms_sql.native);
dbms_sql.bind_array(l, ':kpi_array', col1_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':rm_array', col2_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':day1_array', col3_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':busnunit_array', col4_ins,1,ins_cnt-1);
dummy := dbms_sql.execute(l);
dbms_sql.close_cursor(l);
I am getting an error since any one of the row contains value larger than the column.
How to handle exception handling for those rows which is having errors. I would like insert the records which is having
no errors. Like SAVE EXCEPTIONS for 'forall' is there any option is available to handle exceptional records.
Please help.
Thanks & Regards,
Hari.Hari,
What's oracle version? Are you looking for something similar to this? see following example
DECLARE
TYPE array
IS
TABLE OF my_objects%ROWTYPE
INDEX BY BINARY_INTEGER;
data array;
errors NUMBER;
dml_errors exception;
error_count NUMBER := 0;
PRAGMA EXCEPTION_INIT (dml_errors, -24381);
CURSOR mycur
IS
SELECT *
FROM t;
BEGIN
OPEN mycur;
LOOP
FETCH mycur BULK COLLECT INTO data LIMIT 100;
BEGIN
FORALL i IN 1 .. data.COUNT
SAVE EXCEPTIONS
INSERT INTO my_new_objects
VALUES data (i);
EXCEPTION
WHEN dml_errors
THEN
errors := sql%BULK_EXCEPTIONS.COUNT;
error_count := error_count + errors;
FOR i IN 1 .. errors
LOOP
DBMS_OUTPUT.put_line( 'Error occurred during iteration '
|| sql%BULK_EXCEPTIONS(i).ERROR_INDEX
|| ' Oracle error is '
|| sql%BULK_EXCEPTIONS(i).ERROR_CODE);
END LOOP;
END;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE mycur;
DBMS_OUTPUT.put_line (error_count || ' total errors');
END;Regards
OrionNet -
How to handle fieldnames ending with # in JDBC receiver?
Hello Experts,
I am developing a scenario JDBC to IDOC. I have 2 tables for header & line item. I have to retrieve a header record first using sender JDBC & then for that header need to fetch the corresponding lineitems from second table.
We cannot have data types defined in XI with fieldnames containing # or any other special charecter. Both DB tables contain fieldnames ending with #.
For Sender JDBC, I managed it in SQL query using :
Select abc, xyz# as xyz .... from tbname
But for receiver JDBC we need to define a data type with the typical format ( Doccument format required for JDBC receiver).
Please let me know how to handle this for JDBC receiver.
Thanks in Advance & hope for a quick replies.
Abhijeet.Hi Abhijeet,
If you can write a query with join( you can call join query using JDBC adapter), i think this would be a fastest way and good approch rather than having 2 JDBC call.
Another approch would be writing SP( stored procedure and then you can have your complete logic here). You can call SP using JDBC adapter.
Eventhough query would be complex...it will be one time job.:)...I am not sure about data type for handling field names with special characters.
Let me know if you need more details.
Nilesh
Maybe you are looking for
-
I'm using the MHDDK for analog out/in with the PXIe 6341 DAQ card. The examples, e.g. aoex5, show a single Timer (outTimerHelper::loadUI method), but the example shows DMA data loaded with the same vector size. There is a comment in the outTimerHelp
-
TCP/IP communication with remote host
Hey guys,I wrote a class for TCP/IP communication with remote host.I am trying to use this class in following way:Its not working.One thing I am not sure about if I can give IP address of the machine while creating a socket.Please take a look at my p
-
Serious Vector Casting Help!!
I have a Vector of Strings. I want to convert this to an array of strings. How do I go about this. Here is some code excerp public static String[] getHeader(Vector values, int format) Vector headerFields = new Vector(); for( int i = 0; i < values.siz
-
Osda06us.exe will not extract
WinXP install cd will not see the HDD and I need the SATA driver to get this moving. I downloaded this file and when I run it, nothing happens, no extraction, nothing. I've repeated the download and even downloaded it from different computers. Can
-
$ dollar sign in variable
Hi guys, I am looking for dynamic SQL and I found like this in some variables: .... WHERE empid = LN$Id or : LC$total .... can some one explain to me what the ( $ )dollar sign do in variable and do you have some examples and what the purpose of