Skip to main content
Question

How to convert an inbound array into a single string?


Forum|alt.badge.img+1
  • Do Gooder (Customer)
  • 2 replies

I am seeking to receive an array from our customer’s system and convert it into a single string that we can add as a note.

They are sending the below in the body of their message:
 

"request": {
"site_id": "0085",
"template_id": "1533",
"cross_reference_id": "RTS-326",
"po": "RTS-326",
"priority": "",
"part_id": ["00DN001","00L8367","01L1646","011545A","01L1647"],
"long_description": "Testing scanner order"
}



When reviewing the transaction logs, I can see that all 5 parts were interpreted in the system but only the first part_id, 00DN001, populates in the notes.

<request>
  <site_id>0085</site_id>
  <template_id>1533</template_id>
  <cross_reference_id>RTS-326</cross_reference_id>
  <po>RTS-326</po>
  <priority>
  </priority>
  <part_id>00DN001</part_id>
  <part_id>00L8367</part_id>
  <part_id>01L1646</part_id>
  <part_id>011545A</part_id>
  <part_id>01L1647</part_id>
  <long_description>Testing scanner order</long_description>
</request>

Is there a way to concatenate the multiple part_ids being passed in the array into one string? can it be done with an integration map function, or does it need to be done another way? I was unable to find any detailed information on dealing with arrays in the FSM Connect documentation and would appreciate any assistance.

3 replies

Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • 2 replies
  • July 25, 2023

I am also willing to accept an option that will let me turn the array into multiple notes, if it’s not able to be concatenated into one string; i.e., are we able to create 5 notes from the above message instead?


SAMLK
Hero (Partner)
Forum|alt.badge.img+13
  • Hero (Partner)
  • 233 replies
  • July 27, 2023

Hi @Dean OC ,

There should be a workaround to concatenate the json array with a function and then attach to request notes but this needs to be investigated as I don’t recall a straight forward way to do this. But since you have requested to create 5 notes from the array, it should be possible to create a new relationship on your xml map as below. Make sure to provide the part_id on the extract path. Will let you know in case if I found a way around to achieve your first requirement in the meantime.

 


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • 2 replies
  • July 28, 2023

Thank you very much for your response- I have tried implementing your suggested fix, but when I add “part_id” to the extract xpath, I get the following error:

EXCEPTION   Columns: Text in table Request Text are required.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings