Four Stars

Concat XML loop attributes (byte array) to a string?

I have a byte array in XML that looks like this:

            <tsusip>
                <id>2</id>
                <id>123</id>
                <id>39</id>
                <id>-98</id>
                <id>0</id>
                <id>0</id>
                <id>3</id>
                <id>-24</id>
                <id>32</id>
                <id>69</id>
                <id>32</id>
                <id>32</id>
            </tsusip>

Is it possible to concatenate the whole byte array in order to store it in one column in a database?
The result could either be the face value concatenated with a delimiter like '2,123,39...' or translated HEX form like '027B27...' .

  • ESB
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Nine Stars TRF
Nine Stars

Re: Concat XML loop attributes (byte array) to a string?

Use tFileInputXML to get the values:

Capture.PNG

Then use a tJavaRow to load a global variable:

output_row.value = input_row.value;
globalMap.put("result", ((String)globalMap.get("result")) == null ? input_row.value : ((String)globalMap.get("result"))+","+input_row.value);
System.out.println((String)globalMap.get("result"));

Here is the result:

2,123,39,-98,0,0,3,-24,32,69,32,32

Hope this helps.


TRF
1 REPLY
Nine Stars TRF
Nine Stars

Re: Concat XML loop attributes (byte array) to a string?

Use tFileInputXML to get the values:

Capture.PNG

Then use a tJavaRow to load a global variable:

output_row.value = input_row.value;
globalMap.put("result", ((String)globalMap.get("result")) == null ? input_row.value : ((String)globalMap.get("result"))+","+input_row.value);
System.out.println((String)globalMap.get("result"));

Here is the result:

2,123,39,-98,0,0,3,-24,32,69,32,32

Hope this helps.


TRF