For-each loop in OSB
Hi,
I have a senario where i have a varied length XMl is coming to me in response of a service callout, and I need to iterate over it to get the fieldvalue of a particular tag based on its fieldName(e.g FUNCTION_CODE) and assign to a tag of another xml for example
THE XML Coming as response of service callout is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getDefaultValueResponse xmlns="http://data.transformation.nab.cz.fc.ofss.com">
<getDefaultValueReturn>
<fieldDefaultValue>F</fieldDefaultValue>
<fieldName>FUNCTION_CODE</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>PAYMENT_TRANSACTION_ID</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>CHANNEL_ID</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue>CR</fieldDefaultValue>
<fieldName>CREDIT_DEBIT_FLAG</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>BRAND</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue>001</fieldDefaultValue>
<fieldName>ACCOUNT_STATUS</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue>Mr</fieldDefaultValue>
<fieldName>NAME_TITLE</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue>Y</fieldDefaultValue>
<fieldName>MAIL_RETURN_INDICATOR</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>ENTITY</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>TRANSACTION_CURRENCY</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>VERSION</fieldName>
</getDefaultValueReturn>
<getDefaultValueReturn>
<fieldDefaultValue xsi:nil="true"/>
<fieldName>TRANSACTION_RATE</fieldName>
</getDefaultValueReturn>
</getDefaultValueResponse>
</soapenv:Body>
</soapenv:Envelope>
and i want to assign that value to transactionType tag of
<?xml version="1.0" encoding="UTF-8"?>
<tns:sandstonetns xmlns:tns="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com Sandstone_Data_Transaction_History_Response.xsd ">
<tns:listOfTransactions>
<tns:transactions>
<tns:clients>
<tns:clientID>tns:clientID</tns:clientID>
</tns:clients>
<tns:timestamp>2001-12-31T12:00:00</tns:timestamp>
<tns:sequenceNumber>tns:sequenceNumber</tns:sequenceNumber>
<tns:description>tns:description</tns:description>
<tns:amount>0</tns:amount>
<tns:accountNumber>tns:accountNumber</tns:accountNumber>
<tns:debitOrCreditFlag>tns:debitOrCreditFlag</tns:debitOrCreditFlag>
<tns:*transactionType*>tns:transactionType</tns:transactionType>
</tns:transactions>
</tns:listOfTransactions>
<tns:returnResponse>
<tns:returnCode>0</tns:returnCode>
<tns:returnDescription>tns:returnDescription</tns:returnDescription>
</tns:returnResponse>
</tns:sandstonetns>
I want to achieve this using for-each loop...kindly help me as I dont have any idea about how to use for-each loop...
i want to select a the tag fieldValue based on the data in tag fieldName for eg if i iterate over the whole response XML searching for fieldName=FUNCTION_CODE then I whuold get the value 'F' and then I would assign this value 'F' to the transactionType tag of the XML
<?xml version="1.0" encoding="UTF-8"?>
<tns:sandstonetns xmlns:tns="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com Sandstone_Data_Transaction_History_Response.xsd ">
<tns:listOfTransactions>
<tns:transactions>
<tns:clients>
<tns:clientID>tns:clientID</tns:clientID>
</tns:clients>
<tns:timestamp>2001-12-31T12:00:00</tns:timestamp>
<tns:sequenceNumber>tns:sequenceNumber</tns:sequenceNumber>
<tns:description>tns:description</tns:description>
<tns:amount>0</tns:amount>
<tns:accountNumber>tns:accountNumber</tns:accountNumber>
<tns:debitOrCreditFlag>tns:debitOrCreditFlag</tns:debitOrCreditFlag>
*<tns:transactionType>tns:transactionType</tns:transactionType>*
</tns:transactions>
</tns:listOfTransactions>
<tns:returnResponse>
<tns:returnCode>0</tns:returnCode>
<tns:returnDescription>tns:returnDescription</tns:returnDescription>
</tns:returnResponse>
</tns:sandstonetns>
Similar Messages
-
How to use For Each execution in OSB
hi all,
I'm confused about the 'For Each' action in OSB. Now, I have a variable('max') which equals to 3 , and I wanna to use For Each action to perform a loop execution, something like for(1 to 3)--
The code is like below:
For Each variable 'value' of variable 'max' ,
Do{
Assign value to variable tempMsg;
Service Callout to PS with tempMsg
What I think is the 'value' should be increased from 1 to 3 itself, and the service callout should be performed by 3 times with '1', '2', '3'. However, it's not, the service callout action was performed once with the value of 3, just like the 1 and 2 were overwritten.
Any idea?Using 'For Each' activity in OSB
Thanks,
Vijay -
Hi,
I am new to Oracle Service Bus 11g. Could you please explain how the for each action in osb can be used.
I have xml which is received from another service. I want to loop for each item and send this userId to particular callout.
<execute service="myHistory">
<input>
<param name="userList" type="list">
<item>
<param name="userId">143<param>
</item>
<item>
<param name="userId">14<param>
</item>
<item>
<param name="userId">14<param>
</item>
<item>
<param name="userId">143<param>
</item>
</param>
<param name="dateFrom">01/01/2001</param>
<param name="dateTo">01/01/2009</param>
</input>
</execute>
Thank you
Edited by: OlegS on Apr 20, 2011 4:38 AM
Edited by: OlegS on Apr 20, 2011 4:39 AM
Edited by: OlegS on Apr 20, 2011 5:30 AMIs it a part of for each activity? Where should I put it in ?
I see only these fields in each activity:
-for each variable
-xpath
-index variable
-count variable.
I can't find any example how to use this kind of activity. Could you please explain how to fill these fields for my case.
Thank you.
Edited by: OlegS on Apr 20, 2011 6:27 AM -
How to use for each loop in XSLT when my source is a multilayout file and db
How do I use a for each loop in XSLT when my source is multilayout file and db .
My multilayout file is basically contain 2 kind of data one for employee and another for dependent.
Now my requirement is I want to read each line of data whether it is it is employee or dependent do a join with db and write it in my target file.
eg : File content
1 RichaKumari 311289 TCS INDIA
2 KiarnKumar 456782 BRO RichaKumari 311289 INDIA
2 Ravi 456882 BRO RichaKumari 311289 INDIA
eg : db Content
311289 RichaKumari TCS INDIA Bangalore [email protected]
Now in Final File I need something like this :
1 RichaKumari 311289 TCS INDIA
2 KiarnKumar RichaKumari 311289 TCS INDIA
2 Ravi RichaKumari 311289 TCS INDIA
here 1 and 2 are the identifier which will decide which layout to follow .Hi,
I think you'll need two nested for-each's... Something like...
<xsl:for-each select="$root/row[layout = 1]">
<xsl:variable name="employee" select="."/>
... write employee ...
<xsl:for-each select="$root/row[layout = 2 and dependentid = $employee/id]">
... write dependent ...
</xsl:for-each>
</xsl:for-each>
Cheers,
Vlad -
Loading accdb file using for each loop in to single target table
I have 3 accdb file as below in single folder, in control flow I have created a for each loop to loop through all the below file. In dataflow task I have created oledb source using connection manager to point to first file a1.accdb. I am trying
to load all the file into single below mentioned target table, here It is only loading first file it is not looping through other two file.
This I have tried to load .txt files and csv files it is working perfectly but similarly when I try to load access db file table it is not working, can any one of you help me?
1. a1.accdb contains only one table a1tab ( col1 col2 col3 )
2. a2.accdb contains only one table a2tab ( col1 col2 col3 )
3. a3.accdb contains only one table a3tab ( col1 col2 col3 )
I have a target table with similar structure as source
Target table <TargetTable> Col1 Col2 Col3
aakThanks Arthur, please find below response
How do you handle the different table names? Cant we handle it in a similar manner, how we handle the .csv/.txt files with different name and similar structure for sources(multiple files) and target (single table)
Is it good to drop the idea of for each loop and create a separate task for each accdb file? to be loaded to same target table( performance wise etc.. any justification would be helpful)
You must handle the connection string dynamically?
Can you help me with the logic for handling connection string dynamically
aak -
How can I enable for-each loop in Creator update 1?
I try to use for-each loop, but I got error message from compiler is
" for-each loops are not supported in -source 1.4. (try -source 1.5 to enable for-each loops)"
How can I switch my source to 1.5.. I am using jdk 1.5. Confusing.
Thanks .
RichardHi!
Actually Sun Java Studio Creator doesn't support Java EE 5 projects. If You want to create Java EE 5 project, try to use NetBeans with Visual Web Pack installed.
Thanks,
Roman. -
For Each Loop in Jdev 10.1.2.17.84
Is there anyway of using a for each loop in Jdev 10.1.2.17.84? I get errors for the standard syntax:
for (int item : numbers) {
System.out.println("Count is: " + item); }
Am i missing something?Okay, i'm on 10.1.3 now and the syntax:
for (int item : numbers) {
System.out.println("Count is: " + item); }
still doesn't work. What am I missing now?
On compile I'm getting:
Error(41,23): ; expected
for the line with for (int item : numbers) { -
My trace statements inside my for each loop won't show.
Please someone check my code. I"m getting no errors in flex
builder. When i debug all vars are holding prober data. Thanks so
much"essa tkinen" <[email protected]> wrote in
message
news:gr27rt$3sb$[email protected]..
> yes there is data there a commas delimited list of
keywords that are
> catagorys. the selectedCatArray holds at list one
element. I want to
> return true if element is in that list
For one thing, you're going to exit the function in the first
iteration,
because you return the result inside the loop. Return
immediately exits the
function. For another, I'd be tempted to switch it to
something more like
this:
for (var i = 0; i<_item.cats.length; i++) {
var iCat=item.cats
//do your stuff here
I have had really bad luck getting for each in to work the
way I think it
should.
HTH;
Amy -
Hello Everyone,
Please assist with a step by step guide on how to setup a For Each Loop for XML Task
I'm trying to convert XML to XSLT
I have tried more than 10 times and i just do not know what i am doing wrong - no error, my package just runs for a few seconds but nothing happens
Thanks in advance
DeeI managed to get my XML to XSLT to work but now when i run my package to import the data into SQL table,
it stops after a few records, i get the following error:
[XML Source [1]] Error: The component "XML Source" (1) was unable to process the XML data. The element "Errors" cannot contain a child element. Content model is text only.
Please assist
Check this:
http://social.msdn.microsoft.com/Forums/en-US/80726e0c-9e85-43ca-87bc-7cf90fd7fb31/xml-source-data-flow-throws-cannot-contain-a-child-element-content-model-is-text-only-error?forum=sqlintegrationservices
Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
The climb is all there is. -
As we know that For Each loop is more easy to use and iterate. I want to ask, is it possible to run for each loop in reverse order?
Please help.
I will be very much thank ful to you.Sure. did you notice that it's you who defines the
running condition, the initial value and the
(positive or negative) increment?He's talking about the new for loop.
The for-each loop can't do everything the old one can. Try reading this explanation.
http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html -
For Each loop that iterates in reverse order
Can I use the For Each loop to iterate in reverse order?
Like this:
int[] array=new int[10];
for(int i=array.length-1;i<=0;i--)
int j=array; -
"for each" loop - under the hood question
Question about the for each loop. Is it optomized? I think this is a poor use of memory management -
for (int i = 0; i < stop; i++) {
Object obj = new Object();
doSomething(obj);
}And this is the ideal, using the same object -
Object obj = new Object();
for (int i = 0; i < stop; i++) {
doSomething(obj);
}So underneath the hood, which is the for each loop comparable to? I love the syntax, it's very clean-looking in the code, but at the same time I don't want to hurt performance.Question about the for each loop. Is it optomized? I
think this is a poor use of memory management -
for (int i = 0; i < stop; i++) {
Object obj = new Object();
doSomething(obj);
}And this is the ideal, using the same object -
Object obj = new Object();
for (int i = 0; i < stop; i++) {
doSomething(obj);
}So underneath the hood, which is the for each loop
comparable to? I love the syntax, it's very
clean-looking in the code, but at the same time I
don't want to hurt performance.That depends on YOU. You CANNOT write a for-each loop for the code you provided. A for-each loop requires an Iterable. (I think that's what it requires--it at least requires something to iterate over, not just an index variable as you have.)
Consider the following, however:
Object o1 = new Object();
for (Foo foo : fooList) {
Object o2 = new Object();
foo.doStuff(o1, o2);
} It will be equivalent to this:Object o1 = new Object();
for (Iterator iter = foo.iterator(); iter.hasNext();) {
Foo foo = (Foo)iter.next();
Object o2 = new Object();
foo.doStuf(o1, o2);
} How could it be any different? It has to keep the behvior of the "old fashioned" iteration. -
while working in jbuilder2005 i want to use for-each loops i see following error;
" for-each loops are not supported in -source 1.2 (try -source 1.5 to enable for-each loops) "
i configured the jdk libraries source to jdk1.5 even then i found problem
do any body know
Message was edited by:
citymodelWhat it says: Java 1.2 does not have for-each loops. You configured it to use 1.5, but you also configured the compiler to check for 1.2-code compliance. Read the JBuilder manual or help about how to find and change the setting. It's probably somewhere in the project settings.
-
For each loop and modification of a LinkedList
When going thourhg my LinkedList with a for each loop, I want to do a modification. I just saw that it cast a ConcurrentModification Exception, so it seems I can't do that.
How should I do then? I don't want to go through all the list each time an object is removed, I want it to restart where it stopped.Not the best solution but something like thisshould work:
if( linkedList.get(i) == "modification")No: don't compare Strings with the == operator.
http://access1.sun.com/FAQSets/newtojavatechfaq.html#9
You are correct, must be .equals() my bad. -
Hi,
I am trying to use a For each loop:
FE Agreement_No
Customer
0.00
0.00<?end for-each?>
This does not work. Does the code FE need to be grouped?
Can anyone help?
ThanksHi,
I have created a repeating group:
<?for-each-group:ROW;./Agreement_No?>
This places an F in front of agreement_no field
and places E in front of the following field customer.
I would also like to add a condition where installment = 'Under 1'
Would that be <?for-each-group:ROW;./Agreement_No[../Installments='Under 1']?>
Maybe you are looking for
-
Urgent need of help with a chat application!
Hi, I'm writing a Chat Application and I want to add Emoticon, I did so by adding buttons but I don't know how to send the gif to my JTextField and to my JTextArea. Here is part of my code can someone can help me PLEASE!!! JPanel chatPane = new JPane
-
How to connect 3070a printer to my new Pirelli DRG A233G router using my iPad
I only have my iPad with me so can I set this up without a pc.
-
What do the Chinese characters in top left of window fram signify?
In the top left hand corner of the browser frame are a number of what appear to be Chinese characters- which change according to changing pages why are they there? What do they mean? Is it important? Has the program been corrupted? Is my security com
-
I NEED A SOLUTION ON HOW TO UNLOCK THE AFTER EFFECT "Action Trailer.aep"
I NEED A SOLUTION ON HOW TO UNLOCK THE AFTER EFFECT File, "Action Trailer.aep"
-
Best way to handle an event from WaitForSingleObject
Hello LV experts, I would like to know what's the best way to handle an event which I catch using the Win32 API (WaitForSingleObject) in Labview(7.1 or 8.20). I know there is too many possibilities to do this, but I want to do it on the best way. th