I have 2 string lists.String list A contains let’s say a,b,c and d.String list B contains b,d and x.i want to create a new String list C which should contain elements of A minus elements in String list B.i.e in the above example,new list should contain a and c only.
Convert each string list to a java.util.Collection object. The classes that implement Collection include Vector, HashSet, ArrayList, and others. Use the removeAll method to get the relative complement of the sets. Then convert the modified collection back to an array for the pipeline.
OuterLoop:Loop over List A
Map:A to tempElement
InnerLoop:Loop over List B
Branch
SEQ-----A<>B
assign tempVar=0
SEQ-----A=B
assign tempVar=1
Exit InnerLoop
Branch on tempVar
0:Map(append the tempElement to new StringList)
OuterLoop:Loop over List A
–Map:A to tempElement
–InnerLoop:Loop over List B
----Branch
------SEQ(if A<>B)
--------assign tempVar=0
------SEQ(if A=B)
--------assign tempVar=1
--------Exit InnerLoop
–Branch on tempVar
—0:Map(append the tempElement to new StringList)
Hi all,
I have a string list. I have a string field which has a value and should be mapped to the string list. Its in a loop.
So each time it gets mapped, it should form a list of string in the string list with various values.
I mapped the String field to the String list. But its not giving me any output.Do i need to add any transformer in between the string field and the stringlist or just a simple map.
LOOP (InArray: SomeList, OutArray: DesiredStringList)
---- Map StringField to DesiredStringList (Here you will see that DesiredStringList appears as String: which is usual)
ENDLOOP
STEP AFTER LOOP
When you complete the loop and come the step “STEP AFTER LOOP”, you will see the DesiredStringList as stringList with all the various values populated.
Hi Stepheny,
As you wrote:
“I have a string list. I have a string field which has a value and should be mapped to the string list. Its in a loop”.
Based on this, I assumed you have another List and you are looping based on that List. If only List you have is this DesiredStringList, do as follows:
LOOP (InArray: DesiredStringList)
---- Map StringField to DesiredStringList (Here you will see that DesiredStringList appears as String: which is usual)
ENDLOOP
STEP AFTER LOOP
When you complete the loop and come the step “STEP AFTER LOOP”, you will see the DesiredStringList is back as stringList with all the elements in this list populated with the value of StringField.
I dont know, but something is going wrong. That doesn’t work.
May be my question is wrong. Let me reframe my question.
I have a document which contains a field- A which is a string.
I have a document reference which contains a Stringlist- B
(I dont know whether these documents could make any difference.)
There is a loop on the document of A and each the time the loop runs A gets a new value. So if the loop runs 4 times then i have 4 values for A.
I need to store this 4 values of A’s in B.
So before i come out of the loop i should have the B ready with 4 values.
Sorry if my question was wrong before.
Please tell me what should i do for this ? iam trying to use list.append:stringlist,but its giving me error.
In the tolist i have given B
In the fromitem i have A
and in the serviceout tolist i gave B.
Am i going wrong somewhere ??
From your problem statement it looks like the source (where you have string field A) is a document list and not a document, so when you loop over that document list, in each iteration of loop, there is a new value for field A.
With the assumption above, what you are doing looks okay, except for one thing - the name of the service to append is pub.list:appendToStringList. May be you just made a typo. I tried this and it works -
This should get you the result you are looking for… if you are doing just this and still getting an error, post the error message that you are getting.
In the pub.list:appendToStringList i did not understand what are the inputs that are given to the service.
In the “tolist” i could not give document reference as input … (it does not allow)
Do i need to give the stringlist B as an input to the "tolist " which is in the document reference. As the service appends strings to stringlist i cannot give document reference as input to that service.
When i tried giving the Stringlist B as an input to the service, it throws an exception.
Hey i got the solution…May be its temporary.
Its not allowing me to map when its in a document reference, but if i store the values in a stringlist which is not in any document or reference document, then its allowing me to append.
And after i appended all the strings to that stringlist, then i mapped that list to tha list in the document.
Thank you for all your help.
If there is some other solution, plz let me know.
hi all,
I have one more question on this.
Now i got a stringlist, but I should check before inserting into the stringlist that the string already exists or not . If the string already exists, then i should not insert. If it doesn’t exist, then i should insert.
Can someone give me ideas, how to do that ?
Are there any builtinservices to do that ?
Thankyou